#change color of title field

1 messages · Page 1 of 1 (latest)

sudden bridge
#

hey, i have this title field here wich should display the status of a sensor wich either return off or on.
now ideally i want the whole button to be either green or red depending on the state. now its just gray wich doesnt really show much whitout clicking it.

#

i need something like this

dense mulch
#

When you want to make tweaks to a card outside the scope of whatever the developer designed, card_mod can be used. This should work for you: ```yaml
type: tile
entity: binary_sensor.living_room_door_on_off
show_entity_picture: false
vertical: false
hide_state: true
icon_tap_action:
action: none
hold_action:
action: none
card_mod:
style: |
ha-card {
--card-mod-icon-color: white;
--primary-text-color: white;
{% if is_state(config.entity, 'off') %}
--card-background-color: green;
{% else %}
--card-background-color: red;
{% endif %}
}