thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.05k stars 169 forks source link

Tile card: color change no longer works #322

Closed paolo1983 closed 6 months ago

paolo1983 commented 6 months ago

My Home Assistant version: december 2023

My lovelace configuration method: yaml

What I am doing:

card_mod:
  style: |
  .tile {
    --tile-color: red;
   }

What I expected to happen:

The tile color should become Red

What happened instead:

The tile color doesn't change (It remains black)

This issue Is started with december version of home assistant. I'm using this config since 1 year and It always worked until the previous home assistant version (November)

ildar170975 commented 6 months ago

Why this style should work? The fact that this style worked before does not mean that this is going to be forever since the Tile card may be changed in HA. Have you checked a content of this card in Code Inspector? Probably the Tile card's structure changed - that is why your old style stopped working. Now you will have to find out how to style the new changed card.

P.S. what is a "tile color"? Is it a color of the card or some card's element?

paolo1983 commented 6 months ago

Sorry i'm not Expert. Yeah i mean the icon color of tile. With my config i changed It by status of entity (with if then else check). Can you help me to find the new code to change the icon color instead "--tile-color: red"? I'm not able to use inspect Sorry Thanks

card_mod:
      style: |
        .tile {
         {% if states(config.entity)|float(0) > 3000 %}
         --tile-color: red;
         {% elif states(config.entity)|float(0) > 1500 %}  
         --tile-color: yellow;
         {% else %}  
         --tile-color: green;
         {% endif %}  
        }
ildar170975 commented 6 months ago

Inability to style some UI element could be a bug. But also could be a "user does not know". So, suggest to ask this questions in the dedicated card-mod Community thread (in general, questions should be asked in Community, Github should be used for reporting bugs & proposing FRs). If it turns out that this is a bug - then you will give it a go here.

paolo1983 commented 6 months ago

Ok thanks! Have a good day Ciao

ildar170975 commented 6 months ago

Try this:

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

Consider closing the issue if you can solve your task with this proposal.

paolo1983 commented 6 months ago

Friends thanks you very much It works. I have to offer you a beer! Thanks!