Icone color state

What’s wrong with mi code in this card?

type: custom:button-card
entity: sensor.finestra_cucina
name: Cucina
show_state: true
template: null
style: |
  :host {
    -paper-item-icon-color:
      {% if is_state(sensor.finestra_cucina, "OFF") %}    
        blue 
      {% endif %}
      {% if is_state(sensor.finestra_cucina, "ON") %}     
        red 
      {% endif %}
      {% if is_state(sensor.finestra_cucina, "vasistas") %}     
        green 
      {% endif %}
      ;
  }

You don’t tell what are the symptoms.
It’s like asking your doctor: “What’s wrong with me” :wink:

1 Like

Sorry, you are right.
The icon remains white in any state
What am I doing wrong?

You actually do not need card-mod for the button card

See, e.g., Custom: button-card - change icon based on state - #20 by mmillner

If you want to follow the card-mod route, see the button card note regarding which variables are used for the icon color.