lovelace-card-mod: --card-mod-icon-color does not work

My Home Assistant version: 0.XX.X core-2022.3.5 supervisor-2022.03.5 Home Assistant OS 7.5

My lovelace configuration method (GUI or yaml): yaml

What I am doing: trying to get icons to switch color like it used to work with the last version of home assistant also did a cache browsing delete didnt work

also doesnt work in Chrome or Edge both need refresh to work

What I expected to happen: the icon should change color when you toggle the switch

What happened instead:

click the toggle switch it doesnt change color anymore… worked in the last version of the plugin or Home assistant i cant remember hit refresh then it shows the new color…

  - entity: sensor.b_hot_water_tank_state
    name: Hot Water Tank
    icon: mdi:water
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        red
      {% else %}
        blue
      {% endif %}
      ;
      } 

# End of code

Error messages from the browser console:

dont know how to get that


By putting an X in the boxes ([]) below, I indicate that I:

  • Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).

  • Have made sure I am using the latest version of the plugin.

  • Have followed the troubleshooting steps of the “Common Problems” section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.

  • Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

sorry couldnt help ya ):

Should be fixed now.