Sensor color change

Hi,
I am using the custom button-card for some entities so I can change color according to a state and it works well like this:

type: custom:button-card
state:
  - value: 'on'
    color: yellow

I am trying to do same thing with battery sensor, I want to set value over > 25% to turn battery sensor icon to red.
I couldn’t find how to achieve that. Value gives you only a set value and not range.
Any ideas if someone tried that before?
Thanks

Play with this example:

                state:
                  - operator: '>'
                    value: 100
                    color: red
                  - operator: '>'
                    value: 50
                    color: yellow
                  - operator: default
                    color: green

Thanks for the solution, just as a reference, it was reversed, this is the one that worked for me :slight_smile:


state:
  - value: 15
    operator: <=
    color: red
  - value: 30
    operator: '>='
    color: yellow
  - value: 70
    operator: '>='
    color: green