Conditional Icon colour on a Picture Elements card

I’m trying to to change the colour of an icon on my picture elements card based on some states. But the template, whilst works in the Developer Tools doesn’t work in the code. I just get a black or white icon, dependent on which device i’m on. Any ideas?

type: picture-elements
elements:
  - type: icon
    icon: mdi:spa
    tap_action:
      action: navigate
      navigation_path: /fire-panel/pplants
    style:
      top: 40%
      left: 95%
      '--mdc-icon-size': 50px
      color: >
        {% if (states('sensor.moisture_croton') | int < 90 or
        states('sensor.moisture_dracaena1') | int < 90 or
        states('sensor.moisture_dracaena2') |int < 70)%}
        red
        {% else %}
        purple
        {% endif %}

Did you already look into the State Icon Element?

Yeah, but this is an Icon element. I already looked at that too.

color: purple

works, but it’s the template bit that doesn’t!