Change icon colors in a glance card

Hey all, I have a glance card showing the state of my delivery box,

show_name: false
show_icon: true
show_state: true
type: glance
entities:
  - entity: lock.delivery_box
  - entity: binary_sensor.delivery_box_open
  - entity: sensor.delivery_box_battery
  - entity: sensor.delivery_box_operator
title: Delivery Box
state_color: true

image

And icons change based on state, mostly how I’d hope…except for this particular lock, I want it to be green when unlocked (good for delivery) and red when locked (there’s a package inside). Can I do that in the native glance card? I’ve tried a few routes and my icon just full disappears.

do you run a custom theme, or the default theme?
If you do use a custom theme, add the following to your theme yaml file:

  state-lock-jammed-color: '#F44336' # Red
  state-lock-locked-color: '#4CAF50' # Green
  state-lock-pending-color: '#FF9800' # Orange
  state-lock-unlocked-color: '#F44336' # Red

if you are using the default theme, you could try to add this to your configuration yaml:

frontend:
  themes:
    my_theme:
      state-lock-jammed-color: '#F44336' # Red
      state-lock-locked-color: '#4CAF50' # Green
      state-lock-pending-color: '#FF9800' # Orange
      state-lock-unlocked-color: '#F44336' # Red
1 Like

Custom theme – but for other locks in the system (regular door locks), I want the default colors. I want to flip the icon colors for just this one entity.

Card-mod thread - 1st post - link at the bottom - glance card

How do I determine what the available states are for any given entity - in order to work out the right entries (like your state-lock-jammed-color: examples)? I’m looking to do the same across various BMW car sensors I have.

For anyone else…

sorry for the delayed reply … :frowning:
I am just using the documentation for getting the possible states for an entity type.
Doesn’t mean, that the entity is using a particular state - or can report that state…

https://design.home-assistant.io/#misc/entity-state