This code has typos:
- extra “`” after variables;
- no closing “}”.
Use card-mod: either using css variables like you tried or by a direct access to CSS elements.
1.For template sensors - you may define icons inside a template definition.
Docs
2. Alternatively (and for not-template sensors) - you may try using card-mod and “–card-mod-icon” variable.
Not tried myself - but probably by card-mod as well.
Alternatives:
- Card-mod - to change a color on some particular card.
- Custom UI (google it) - to change a color everywhere.
Go to the main card-mod thread for details.
Besides, for Picture-elements card it is possible to style colors STATICALLY by using its native “style” option. If you want to style colors dynamically - card-mod, see examples here.
