Icon colors #242
Replies: 4 comments 7 replies
-
Obviously not as friendly as a UI option. But you can do it with templating. type: custom:mushroom-template-card
primary: Garage
secondary: "{{ states('cover.garage_door') | title }}"
entity: cover.garage_door
icon: >-
{{ 'mdi:garage-variant' if is_state('cover.garage_door', 'closed') else
'mdi:garage-open-variant' }}
icon_color: "{{ 'green' if is_state('cover.garage_door', 'closed') else 'red' }}" |
Beta Was this translation helpful? Give feedback.
-
You can also use the entity: cover.garage_door
type: custom:mushroom-template-card
primary: Garage
secondary: "{{ states(entity) | title }}"
entity: cover.garage_door
icon: >-
{{ is_state(entity, 'closed') | iif('mdi:garage-variant', 'mdi:garage-open-variant') }}
icon_color: "{{ is_state(entity, 'closed') | iif('green', 'red') }}" |
Beta Was this translation helpful? Give feedback.
-
These are fantastic! They are actually even more useful than what I mentioned - for instance, now my garage is green when closed, red when opened, and blue when in motion! This even worked on chips as well. Thanks for the help!! |
Beta Was this translation helpful? Give feedback.
-
hello team, congrats on this nice project. I really like it. I read the above and I wonder if something similar is possible for the " mushroom-light-card " and the cover-card . In essence the mushroom icon color in "off state" is grey and I want it to follow the generic home-assistent off-color as I am mixing cards. Is it possible to use some of the code above or is this limited to the template-card? |
Beta Was this translation helpful? Give feedback.
-
I don't know if any one else would need this, but I would like to see a method for setting both on and off icon colors in the entity card. For instance, right now I have two locks and a garage door. If the lock is locked the icon color matches the selected color on the card. If it is unlocked it shows gray. On the other hand, my garage door shows gray if it is closed, and matches the selected color on the card if it is open. I would like to set it so that when a lock is unlocked or the garage door is open (or any of my door sensors for that matter) the icons are one color (say red) and if the locks are locked, or any of the door sensors are closed the icon to be green.
I can think of a number of cases where setting icon color by on/off or open/closed state would be useful.
Beta Was this translation helpful? Give feedback.
All reactions