Change of icon color based on input_select state

Hi,

I need help configuring the color of an icon, based on a condition. I have a horizontal stack of 3 mushroom template cards.
image
The washing machine has 3 states, controlled by an automation : Off, Running, To empty. I want the icon corresponding to the current state to be a certain color ; but I can’t seem to use the state of the input_select in a conditionnal color ! Here’s the code :

cards:
  - type: custom:mushroom-title-card
    title: Machine à laver
    alignment: center
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        primary: ''
        secondary: ''
        icon: mdi:washing-machine-off
        icon_color: |-
          |-
                {% if {{ states('input_select.statut_machine_a_laver') }}:'Eteint' %}
                  orange
                {% else %}
                  blue
                {% endif %)
        layout: horizontal
        tap_action:
          action: call-service
          service: input_select.select_option
          target:
            entity_id:
              - input_select.statut_machine_a_laver
          data:
            option: Eteint
        badge_icon: ''
        badge_color: ''
      - type: custom:mushroom-template-card
        primary: ''
        secondary: ''
        icon: mdi:washing-machine
        layout: horizontal
        tap_action:
          action: call-service
          service: input_select.select_option
          target:
            entity_id:
              - input_select.statut_machine_a_laver
          data:
            option: Cycle en cours
        icon_color: >-
          if (states('input_select.statut_machine_a_laver').state == 'Eteint')
          return 'orange'; else return 'white';
      - type: custom:mushroom-template-card
        primary: ''
        secondary: ''
        icon: mdi:washing-machine-alert
        layout: horizontal
        tap_action:
          action: call-service
          service: input_select.select_option
          target:
            entity_id:
              - input_select.statut_machine_a_laver
          data:
            option: à vider
        icon_color: >-
          if (states('input_select.statut_machine_a_laver').state == 'Eteint')
          return 'orange' 

          else return 'white';
        fill_container: true

I’ve tried all sorts of different ways, can anybody point out what i’m doing wrong ?

Thanks,

Try

if is_state(‘input_select.whatever’, ‘off’)

I too am struggling with the same thing. I have an input select list, Master hvac mode which can be either Cool or Heat. I want to change the colour of the icon to blue if Cool, red if Heat. This code just doesn’t work, I’ve tried hundreds of combinations but can’t make anything work.

type: custom:mushroom-select-card
entity: input_select.master_hvac_mode
fill_container: false
grid_options:
  columns: 12
  rows: 2
layout: horizontal
icon_color: |-
  {% if is_state('input_select.master_hvac_mode' , 'Cool') %}
    Blue
  {% elif is_state('input_select.msater_hvac_mode' , 'Heat') %}
    Red
  {% endif %}

You cannot template the mushroom-select-card

One option is to use the type:custom:mushroom-template-card or use card_mod if you stay with the select card

Template Card

type: custom:mushroom-template-card
entity: climate.living_room
icon: mdi:thermostat
icon_color: |-
  {% set state = states(config.entity) %}
  {% if state == 'cool' %} green
  {% elif state == 'heat' %} red
  {% else %} gray
  {% endif %}

Select Card

type: custom:mushroom-select-card
entity: input_select.master_hvac_mode
card_mod:
  style: |
    ha-state-icon {
     color:
      {% set state = states(config.entity) %}
      {% if state == 'Cool' %} green
      {% elif state == 'Heat' %} yellow
      {% else %} red
      {% endif %}