do you have card mod installed? If not, that won’t work. Also, the styling needs to be aplied to the picture-elements card. You can’t style elements in the card because there’s already a style field. Card mod cannot step on the toes of existing fields. So you have to use a selector from the picture-elements level to the element you want to change.
You can make a template sensor to pull the attribute out into a state. In your case, I would just build your template into the sensor itself because conditional cannot handle greater than or less than checks.
I have installed card mod. But yes, if it only works on the picture-element itself, it’s not worth it.
Are there any other possibilities to change the color based on a state?
Thank you. I didn’t thought about that, but good to know that this is a workaround for this question.