Ping on dashboard red green

I am using the following to monitor devices to detect if they are on/offline.

I would like the dashboard to show them in green if online and red if not. Is that possible?

Create a template sensor using the ping command to tell a toggle helper to set one way or the other, and then use a card in the dashboard to show the helper.

Thanks only just seen you reply. A bit above me that but I will look into it.

Or