Unable to change sensor theme (color)

I’ve been following this thread trying to change the color of this template for my air quality sensor, but so far been unable to do so:

sensor.air_quality_index state ‘Good’

and I have this in customize.yaml

sensor.air_quality_index:
  templates:
    theme: >
      if (state === 'Good') return 'green';
      if (state === 'Moderate') return 'yellow';
      if (state === 'Poor') return 'orange';
      if (state === 'Bad') return 'red';
      if (state === 'Very Bad') return 'purple';
      return 'black';

ui-lovelace.yaml:

          - type: entities
            entities:
              - entity: sensor.air_quality_index
                name: Indoor Air Quality
                icon: 'mdi:air-filter'

But the color on screen won’t change

Ideas?

yes.
where in the new repo did you find the ‘theme’ you are trying to customize. Did you read the readme or any of the examples at the custom-ui repo?

you’re quoting a post which is about 4 years old…

I’ve tried icon_color as well. that didn’t change either.
I read through this page but didn’t find anything helpful:

I could not find anything newer covering what i was trying to do. So this is no longer supported, i suppose

well, it has never been supported from within HA core. It always needed the custom-ui custom card. the original is no longer valid for Ha Lovelace, but I (try to ) maintain a version that does, at https://github.com/Mariusthvdb/custom-ui

If you install that you can use those templates and use icon_color.

if you only care for the Frontend, you’d be better of with card-mod, which is always updated by magician Thomas Loven

1 Like

P.S. Configuration → Settings → Check Configuration reported no errors, so if those entries were no longer supported, I would have thought it would error out there