Mushroom chips card - changing icon colour depending on state

Hi

I have just started using mushroom cards and am setting up a new dashboard. I am trying to change the icon colour for the chips card at the top of the dash.

I am using the custom chip card. I’ve been searching for a while now and used 3 different templates by following other people’s suggestions but I can not get the icon to change colour depending on state.

I have tried the following code for the individual entity within a custom chip card:

type: entity
entity: binary_sensor.alarm_status
name: Alarm
content_info: state
icon_color: '{{ ''green'' if states(''binary_sensor.alarm_status'') == ''on'' else ''red'' }}'
use_entity_picture: false
type: entity
entity: binary_sensor.alarm_status
name: Alarm
content_info: state
icon_color: |-
  {% if is_state('binary_sensor.alarm_status', 'on') %}
   red
  {% else %}
   green
  {% endif %}
use_entity_picture: false
type: entity
entity: binary_sensor.alarm_status
name: Alarm
content_info: state
icon_color: |-
  {% set state=states('binary_sensor.alarm_status') %}
  {% if state=='off' %}
  red
  {% elif state=='on' %}
  green
  {% endif %}
use_entity_picture: false

I have tried all 3 icon color templates within a custom template card and the colour does change in that card. However I can not get it to work for chips.

I would be very grateful if someone could confirm that it even is possible and point me in the right direction.

Thanks

1 Like

I know this is an old post, but did you ever work this out? I’m trying to do the same thing and have just come across your post.

The type of chip card matters, but here is an example and this is the link to the Mushroom thread

image

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: light.pc_lights
    icon: mdi:mushroom
    icon_color: |
      {{ 'red' if states(config.entity) == 'on' else 'green'}}
    content: |
      {{ 'RED' if states(config.entity) == 'on' else 'GREEN'}}

This video series covers how to change color, as well as show/hide based on conditions and many other things. There are 6 videos in total, but it’s a pretty comprehensive series using mushroom cards for a dashboard.

Thanks - I’ve realised I needed to change to a template card rather than an entity card, as entity cards don’t support colour changes.