accept entities icon_color attribute
See original GitHub issueIs your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I’m always frustrated when […]
Using custom_ui, next to templating existing attributes, we can set (and template) an additional icon_color attribute for an entity.
per domain, per _glob, or per entity. Just like any other customization in HA.
regular entities card in HA respects that, as do many other cards in HA. More-info popup does.
Unfortunately, custom button-card does not.
Describe the solution you’d like A clear and concise description of what you want to happen.
Next to the formatting options button-card does offer (which are huge and great, don’t get me wrong, use them all over) it would be really nice if button-card could accept the icon_color attribute if available ( when set by custom_ui)
Describe alternatives you’ve considered A clear and concise description of any alternative solutions or features you’ve considered.
Additional context Add any other context or screenshots about the feature request here.
set an icon and icon_color, based on the state of the entity. Icon is respected in button-card, unfortunately, icon_color isnt.
One huge advantage would be that the glob customizations we can set using custom_ui, would prevent all individual per entity styling in button cards.
eg check all that is necessary for my battery sensor coloring:
sensor.*_bewegingssensor:
templates: &battery_color
icon_color: >
if (state > 75) return 'green';
if (state > 50) return 'gold';
if (state > 25) return 'orange';
if (state > 10) return 'brown';
return 'red';
sensor.*_dimmer:
templates: *battery_color
sensor.*_afstandsbediening:
templates: *battery_color
sensor.*_remote:
templates: *battery_color
sensor.*_battery_level:
templates: *battery_color
sensor.*_battery:
templates: *battery_color
sensor.battery*:
templates: *battery_color
This makes the magic happen on all core entities cards, but also in auto_entities and others. Now imagine having to write buttons for all of those button cards…
the magic line:
this._iconStyle = {color: stateObj.attributes.icon_color;}
is what made it work in custom_ui. maybe that could be used here too?
please consider? thanks.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:15 (8 by maintainers)
Top GitHub Comments
sure, check all the glob examples in https://github.com/Mariusthvdb/custom-ui/blob/master/EXAMPLES.md
this FR should be closed though, thanks for reminding me 😉
@Mariusthvdb @andrey80nik
Old issue, but hope will be useful still
Not sure if this would work for you, but I am using Customizing entities
The customize_glob specifically makes life a lot easier
I don’t have an icon_color attribute, but the below should give you an example