I have a number of entities (Lamps, Garage Door Covers, Solar Inverter status, etc.) listed as individual entities in an Entities card. In the case of the garage doors and inverter status, using the code below works fine, changing both the icon, text and status to red when appropriate.
However, if the entity is a light (which presumably has some default setting), the text and status change to red, but not the icon color, which turns to yellow.
The example below is a repurposed Hue plug that is now used to switch on/off my water recirculating plug, so itās not really controlling a lamp. From an HA perspective, it thinks it is a light, so itās default āonā color is yellow. I tried overwriting this (code below), but the āāpaper-item-icon-colorā part does not seem to work correctly (as shown in screen shot at bottom).
Update: Tried using Switch template in an attempt to āisolateā the new entity from the Hue plug. When using the new switch entity in the card, the yellow color is still dominant. (However, one success was that I was able to change the icon based on the state.)
Renaming the subject line as this appears to be a more fundamental question: Is it possible to override an iconās default color?
I created a test Entities card with just two entities in it: my garage door and a Hue plug (which controls my water recirculating pump).
The garage door icon turns purple (or mauve) whenever the door not closed. I want this icon to be red.
The Hue plug turns yellow whenever the switch is on. (I also want this icon to turn red.)
Theme doesnāt seem to play a part, as I have āNo Themeā selected
Iāve tried wrapping the Hue plug in a Switch Template - no change, itās still yellow
Iāve tried divorcing the plug from my Hue bridge and adding it as a Zigbee āswitchā. Guess what? Itās still yellow, so I assume it reads the manufacturer āPhilipsā and decides it must still be a light!)
It appears that the icons for these entities have default colors, but I have no idea where this is set, or how to change them. (Clearly, I want to change them on a per-entity basis - I donāt want ALL my Hue light icons to be red.)
Is this even possible, or am I flogging a dead horse?
There are some CSS vars for colors.
Some vars are already defined with some default values (ādefault themeā).
You may define your own custom theme with some vars to override these particular vars (others will keep using their default values).
Also, you may override these vars for PARTICULAR cards:
ā either by defining some custom theme for this card;
ā or by card-mod - for particular card or particular entity:
However, that didnāt make any difference. The icon is still yellow. Almost on the point of giving up.
Thereās got to be a way of overriding the default colors. Iāve scanned all the documentation I can find on the HA side, but nothing addresses this problem.
you can change all state colors in your themes, no need for card_mod, and 100% reliable and supported by core, always preferable to any custom solution, did you have a look at that?
just create a default-adjusted theme, (not as you did I the card_mod) and only change the state-colors in that to your desire, and leave the rest. easy as can be
As I said earlier - to override colors for THIS particular row, otherwise define a custom theme with changed vars to set these colors globally or in particular cards.
seems a bit more than that, as you asked for overriding the icon color and now color the whole line.
edited
I wasnt aware of the type: simple-entity at all, so learnt something today. Though dont understand what it doesā¦ yet. nor why this would be required in your specific setting? just use the entity inside the entities card would suffice?
as far as I understand that it is used to set a helper to a read-only value, so you can not control it. A cover isnt a helper, so this apparently also works on non helpers?
btw this explains how these state-colors work, you can use those on the domain and then the state, just as Ildar showed you
Yea, originally I wanted the whole line (text and icon) to be red when the entity was āactiveā. The text was relatively easy - it was the icon I was fighting with.
No idea why I used the type of simple-entity. I think I tried it, and it did something I liked, but in the ensuring hassle to get the icon to change color, I forgot what it was. I can try removing it to see if it makes any difference - less clutter in the code, the better.
it most certainly does, taking it out makes the icon follow the state-color of the entity
also got to remember that state-colors work only on, well whatās in a nameā the state of the entity:
thereās not much use in templating on != closed and then using the state-open color, or even the -active color. Thatās why Ildar doesnt use that either. Overriding the predefined color, requires you to set those state colors in the card_mod, but not templates on any state, just set them the way you like directly