Mariusthvdb / custom-icon-color

Add icon_color to attributes
GNU General Public License v3.0
14 stars 1 forks source link

Icon color of tile card only updated on page refresh #8

Open chillymattster opened 7 months ago

chillymattster commented 7 months ago

Hi,

I switched from the custom-ui to this new frontend integration. Many thanks for the work and time spend, I appreciate this very much! 😃

I used card_mod in the past to apply the icon_color to tile cards which stopped working. I noticed the readme stating that tile cards are now supported somehow natively. If I open a dashboard, the icon color is correct. However, as soon as the state of an entity changes and the icon_color gets updated, this update is not reflected in the tile card automatically. If I manually reload the page in Chrome and Firefox, the correct icon color is displayed. I checked the DOM and see that style="--icon-primary-color: <somecolor>;" is applied to hui-tile-card, but it is not updated automatically.

Is this the expected behaviour or am I maybe missing something?

Cheers,

Mariusthvdb commented 7 months ago

this indeed is the current state of affairs.

Somehow the way Tile card works is not (yet) fully supported by this plugin. we've been checking the specifics, but development of other functionality got in the way.

If you can add more specifics than tested in that discussion, please join in.

Hope we can realize it some time soon, though no promises made....

chillymattster commented 7 months ago

Hi,

thanks for pointing to the discussion, I indeed missed it. Unfortunately I'm not a professional Webfrontend Developer, so currently I don't really know how to support on this topic.

I spend some more time and at least found a workaround for my case that is based on card_mod and provides the same behaviour as a "normal" tile without icon_color:

type: tile
entity: <someEntity>
card_mod:
  style: |
    ha-card {
      --icon-primary-color: {{ state_attr('<someEntity>', 'icon_color') }};
      --tile-color: {{ state_attr('<someEntity>', 'icon_color') }} !important;
    }

I will spend some more time to see if there is another way without card_mod.

Cheers