Button Card not changing icon color

hi there,

i want to change the icon color with bottom card in a horizontal-stack.
every card should have a different if/elseif/else

this is what i got so far:

type: custom:button-card
name: Kroton
custom_fields:
  styles:
    card:
      type: horizontal-stack
      cards:
        - entity: sensor.xiaomi_miflora_moisture
          type: custom:button-card
          show_state: true
          show_name: false
          icon: mdi:water-percent
            - color: <
               [[[
                 if (entity.state <= 40) return 'blue';
                 if (entity.state >= 20 && entity.state < 40) return 'green';
                 else return 'red';
               ]]]
        - entity: sensor.xiaomi_miflora_temperature
          type: custom:button-card
          show_state: true
          show_name: false
        - entity: sensor.xiaomi_miflora_illuminance
          type: custom:button-card
          show_state: true
          show_name: false
          icon: mdi:white-balance-sunny
        - entity: sensor.xiaomi_miflora_soil_conductivity
          type: custom:button-card
          show_state: true
          show_name: false
          icon: mdi:sprout

can someone please give me a hint?