Background color mushroom cards

Hello. Does anyone know if a mushroom card’s background color can be changed depending on the state? Thank you so much

i dunno if mushroom cards have built in support for it, but you could do it with card_mod:

card_mod:
  style: |
    ha-card {
      {% if (states('input_boolean.test') == 'off') %}
        background: red;
      {% else %}
        background: purple;
      {% endif %}
    }

Can this be done in 2024.7 configuration using visual configuration?

sure, it works in 2024.7

in the ui you have to flip it to yaml in the card, then you can add this at the bottom.

It worked. thank you so much

1 Like