[SOLVED] Icon color on themes (open window)

New way to get It working with december 23 home assistant version:

card_mod:
  style: |
    ha-card {
      --tile-color: green !important;
    }

Ciao belli

1 Like

I am also after a solution for this? does anyone know how to get this to work with the current HA version?

I have an entity sensor.lumi_lumi_weather_master_temperature_3 and I want this to be red above 26C, Green above 21c (but below 26C) and then blue below 21c. how would I do this?

thanks

I just changed from this

card_mod:
   style: |
      .tile {

to this:

card_mod:
   style: |
      .icon {
1 Like

yes, that does work, too - BUT i just did a test with the ha-card { } css provided above, and it seems that this will also change the cards background color accordingly… so it is the better option :slight_smile:

Thanks

I cant seem to get mine to change colour, have I got something wrong

type: tile
entity: sensor.lumi_lumi_weather_master_temperature_3
card_mod:
style: |
.icon {
{% if states(config.entity)|float(0) > 24.9 %}
–icon-color: red;
{% elif states(config.entity)|float(0) > 22.9 %}
–icon-color: orange;
{% elif states(config.entity)|float(0) > 18.9 %}
–icon-color: green;
{% else %}
–icon-color: blue;
{% endif %}
}

I my case this works - please note the --tile-color instead of --icon-color

card_mod:
    style: |
      .icon {
        {% if states(config.entity)|float(0) > 64.9 %}
          --tile-color: red;
        {% elif states(config.entity)|float(0) > 61.9 %}
          --tile-color: orange;
        {% elif states(config.entity)|float(0) > 39.9 %}  
          --tile-color: green;
        {% else %}  
          --tile-color: darkblue;
        {% endif %}  
            }

Which one? I am not quite sure which you mean.

sorry… the option with ha-card is the better option, because it does also affect the tile card color on mouse over…

:slight_smile: Thank you.
That makes sense and works nicely.

Consider using mushroom template card, much easier to set up and has all the features you need.

1 Like