Invert sensor icon state color

Built a bathroom lock indicator yesterday. It’s an MQTT binary sensor.
This is how it looks in UI:

Screenshot_2022-01-06 Home Assistant
No skinning/CSS done except the default color scheme from HA profile. mdi:lock is used.

I would like the lock to be yellow when locked and default (red here) when unlocked. So it is in sync with the light above it. Template icon can change an icon but not the color state, as far as I know.

Any way to do this?

(Just found GitHub - iantrich/config-template-card: 📝 Templatable Lovelace Configurations which probably does the job, but can HA do this natively?)

Hello, i’ve same problem with the door of my washing-machine. Have you found an easy solution ?

No solution found. Probably have to turn this into a feature request.

I have the same issue in one of my cards:

therefore, I’ve created a feature request:

Thanks. I voted.