Dynamically change the view icons?

Can I dynamically change my icon color on the view? For example, is any light is on, change the color of the lights view icon?

ha icons

2 Likes

I realize this is an old conversation, and although I’ve done a lot in HA, I’m new to HA themes. I’ve tried to read the above post and docs on themes, but I’m just not getting this to work for me.

I have this:

A dashboard with raw code

views:
  - title: Home
    icon: mdi:home-outline
...
  - title: Lights
    icon: mdi:lightbulb-outline
 
...

configuration.yaml has

frontend:
  themes: !include_dir_merge_named themes

In the themes folder I have a my_themes.yaml

my_theme:
    card-mod-root-yaml: |
    
        .: |
    
          paper-tab[aria-label='Lights']
          {
            color: red;
          }

I tried this.

theme: my_theme
views:

I also tried this.

views:
  - title: Home
...
  - title: Lights
    theme: my_theme
...

Neither of these worked. Can anyone share detailed steps on how to get the light bulb icon for the Lights tab below to be red? Eventually I’ll make it dynamic with a template based on entity state, but for now a simple test red color would suffice.

Thanks for the help.