Mushroom Chips Card -Change Color of Icon depinding on state -not working-

Sure,

I am glad you are helping me. any time is ok.

Thank you for your time!

what other states are you looking for?

Here’s a dumb example using your current icon_color:

icon_color: "{{ 'green' if states('light.study') in ['on','off'] else 'red' }}"

icon_color will always be green in this example as the only two states for light are on and off'.

well i have a state for my airco.

and now i have this code:

icon_color: >-
      {{ 'green' if states('climate.146235046522113_climate') == 'auto' else
      'red' }}

However i need these also auto, cool, fan_only, heat

So try this:

icon_color: "{{ 'green' if states('climate.146235046522113_climate') in ['auto','cool','fan_only','heat'] else 'red' }}"

However, if the only other option is off, its’s easier to just reverse it:

icon_color: "{{ 'red' if states('climate.146235046522113_climate') == 'off' else 'green' }}"

Thank you verry much.

The first line is working perfectly!

bonjour,
je débute en yaml…
pourriez vous publier le yaml de toute la carte ?
merci

Il y en a trop.
Que voulez-vous faire ?

Hi, can you help me please. I’ve followed this thread but mine aren’t changing colour.

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: sensor.wp66lsd_plug_state
    double_tap_action:
      action: none
    tap_action:
      action: none
    hold_action:
      action: none
    icon_color: "{{ 'green' if states('sensor.wp66lsd_plug_state') == 'plugged' else 'red' }}"

Device is plugged in and it’s state is ‘plugged’.
I’ve gone to developer tools > states and these are all the available states the devices do:
options:

  • unplugged
  • plugged
  • plug_error
  • plug_unknown

Not sure what I’m doing wrong, as I’ve picked the correct state option.

you can’t change colour with an entity card, you need the template card:

type: custom:mushroom-chips-card
chips:
  - type: template
2 Likes

I have farted around with for months, just like Mick I couldn’t get no satisfaction. Finally just changed to custom button cards, can make them look just like chips card with a lot more formatting options!

Found this theme, read almost all. For the future guys, it should look like this:

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: switch.someswitch
    icon: mdi:desktop-tower-monitor
    icon_color: |
      {% if is_state(entity,'on') %}
        #6b11b4
      {% else %}
        gray
      {% endif %}
    hold_action:
      action: none
    double_tap_action:
      action: none
    content: ChipsTitle
2 Likes

Hi Sorry,
Would anyone be able to help with this?
I am trying to change the battery colour on the %
at the moment the iphone battery is 46% and shows red?
Thanks :slight_smile:

  ```- type: custom:mushroom-chips-card
    chips:
      - type: entity
        entity: sensor.my_iphone_battery_level
      - type: entity
        entity: device_tracker.my_iphone
        content_info: state
        icon_color: white
        icon: mdi:home
    alignment: start
    card_mod:
      style: |
        ha-card {
          {% if states('sensor.my_iphone_battery_level') > '50' %}
            --card-mod-icon-color: green;
          {% elif states('sensor.sensor.my_iphone_battery_level') < '49' %}
            --card-mod-icon-color: orange;
          {% elif states('sensor.my_iphone_battery_level') < '5' %}
            --card-mod-icon-color: red;
          {% endif %}
        } 
columns: 2

Please try this. Values need to be integers, no quotes.

type: custom:mushroom-chips-card
chips:
      - type: entity
        entity: sensor.my_iphone_battery_level
      - type: entity
        entity: light.pc_hue_bar
        content_info: state
        icon_color: white
        icon: mdi:home
alignment: start
card_mod:
      style: |
        ha-card {
          {% if states('sensor.my_iphone_battery_level') | int > 50 %}
            --card-mod-icon-color: green;
          {% elif states('sensor.my_iphone_battery_level') | int < 49 %}
            --card-mod-icon-color: orange;
          {% elif states('sensor.my_iphone_battery_level') | int < 5 %}
            --card-mod-icon-color: red;
          {% endif %}
        } 
columns: 2
1 Like

Hi, I’ve noticed that I’m unable to change the color of the mushroom chips icon if the entity is a script (and doesn’t really have any state). No matter what color I put into the icon_color property it’s ignored. Using card_mod doesn’t help neither

any thoughts?

I didn’t have any color issues with card_mod or icon_color. Add the type:template setting for more control.

image

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: script.fan_speed_1
    icon: mdi:mushroom
  - type: template
    entity: script.fan_speed_2
    icon: mdi:mushroom
  - type: template
    entity: script.fan_speed_3
    icon: mdi:mushroom
card_mod:
  style: 
    mushroom-template-chip:nth-child(1)$: |
      ha-state-icon {
        color: red !important;
      }
    mushroom-template-chip:nth-child(2)$: |
      ha-state-icon {
        color: yellow !important;
      }
    mushroom-template-chip:nth-child(3)$: |
      ha-state-icon {
        color: lime !important;
      }
chips:
  - type: template
    entity: script.fan_speed_1
    icon: mdi:mushroom
    icon_color: red
  - type: template
    entity: script.fan_speed_2
    icon: mdi:mushroom
    icon_color: red
  - type: template
    entity: script.fan_speed_3
    icon: mdi:mushroom
    icon_color: red

image

1 Like

it changes to the desired color only when I press then button (toggle). I’ve tried all sort s of overrides and importants, no luck. I’m giving up for now. Script is a simple call to a service.

[UPDATE] I’ve now noticed that you are using a type: template where as I was using an entitiy chip. This one now works. Thanks!

It’s all good! I tried to point that out :joy: Glad you got it working

1 Like

thank you for this