Auto state colour change based on calendar

Hi,
I have a template sensor that gives Calendar message for my rubbish collection calendar of either Black or Pink (colours of the sacks) is there a way to change the state colour automatically. For example when the calendar message is Black the state colour is black, when the calendar message is Pink the state colour is pink. I’m currently using the tile card to show it but happy to use any card if it means I can do the above.

Hope that makes sense and someone is able to help.

Tile Card:

type: tile
entity: calendar.rubbish
tap_action:
  action: none
icon_tap_action:
  action: none
state_content: message
icon: mdi:trash-can-outline
name: ' '
card_mod:
  style: |
    ha-card {
      border-radius: 20px;
    }

Template sensor:

{{ state_attr('calendar.rubbish', 'message') }}

Hi,
Someone may be able to help you but you would need to share your code and what you have tried in order to help.
See the FAQ for more information.
https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question.

1 Like

That better?

1 Like