Sensor icon colour

Hi

Until recently (2 or 3 HA updates back I think) I had sensor cards like:

     - entity: sensor.sdm230import
        graph: none
        state_color: true
        icon: 'mdi:import'
        name: Import
        style: |
          :host {
            --paper-item-icon-color:
              {% if states.sensor.import_power.state|int > 0 %}
                red
              {% else %}
               rgb(138, 185, 45)
              {% endif %}
              ;
        type: sensor

and the colour of the icon would change according to the if condition.

Why is this not working anymore?

have you tried to change your styling so it always use say, red? just to test

No I haven’t. How would you do that?

BTW this was working a while back.

just

style: |
  :host {
    --paper-item-icon-color: red

did you update home assistant in the past few weeks? Did you update card mod? Were you running lovelace in yaml mode and updated?

Yes, yes & no

Resources are handled differently now. Try CTRL+F5. Do the cards reload?

It’s Cmd R for me on a Mac.

Still no joy.