It.image with clor depending on HA state

Hi all,
I’m trying to display on a small ESP touchscreen the icon of a light in a color that depend on the state of the light in HA. I can import in ESPHome the state of the light, but how can I change the color of the icon on my small display depending on this state?

Did you find some of the examples?

Best to share what config you’ve got so far…