🔹 Card-mod - Add css styles to any lovelace card

Please, help me to customize icon color of my battery_s7edge sensor depending on it’s state.

cards:
  - cards:
      - elements:
          - entity: person.oleksandr
            style:
              color: cyan
              left: 20%
              top: 93%
            type: state-label
          - entity: sensor.battery_s7edge
            style:
              '--paper-item-icon-color': green
              left: 65%
              top: 94%

           

This does’t work…
style: |
:host {
–paper-item-icon-color:
{% if states(config.entity)|int < 20 %}
red
{% else %}
green
{% endif %}
;


            type: state-icon
          - entity: sensor.battery_s7edge
            style:
              color: white
              left: 80%
              top: 94%
            type: state-label
        image: /local/pics/card_oleksandr.png
        style:
          .: |
            ha-card {
              border-radius: 27px
              border: 1px solid rgba(100,100,100,0.3);
              overflow: hidden;
              width: 97%;
              box-shadow: 3px 3px 5px rgba(0,0,0,1);
            }          
        type: picture-elements
      
    type: horizontal-stack
type: vertical-stack