Nerwyn / android-tv-card

A completely customizable universal remote card for Home Assistant. Supports multiple platforms out of the box.
Apache License 2.0
254 stars 13 forks source link

Icon color no longer seems to work #122

Closed priyankub closed 3 months ago

priyankub commented 3 months ago

Checklist:

Release with the issue:

Last working release (if known):

Browser and Operating System:

Description of problem: I use CSS style and color to change color of icons based on current selected source, and status of lights etc. It seems to have stopped working after some update:

    icon: mdi:desktop-tower
    tap_action:
      action: call-service
      service: media_player.select_source
      service_data:
        entity_id: media_player.home_theater_2
        source: PC
    style:
      color: |
        {% if is_state_attr("media_player.home_theater_2","source","PC") %}
        #007243
        {% endif %}  
  light:
    icon: mdi:lightbulb-cfl-spiral
    style:
      color: |
        {% if states("switch.av_room_light_switch") == "on" %}
          #cfbf0c
        {% endif %}
    tap_action:
      action: call-service
      service: homeassistant.toggle
      target:
        entity_id: switch.av_room_light_switch

Javascript errors shown in the web inspector (if applicable):

Your Full Remote Config

Additional information:

Nerwyn commented 3 months ago

Use --icon-color in the style field instead. It was a minor breaking change in version 3.9.0. in the version 4 beta, you can instead use the icon CSS selector.

.icon {
  {% if states("switch.av_room_light_switch") == "on" %}
  color: #cfbf0c;
  {% endif %}
}
priyankub commented 3 months ago

That works. Thanks!

joq3 commented 2 months ago

Similar to this topic, how do I change the icon conditionally on the new version? On the old version I did this with my custom button:

icon: > {% if state_attr('media_player.yamaha', 'sound_mode') == 'all_ch_stereo' %} mdi:speaker-multiple {% else %} mdi:speaker {%- endif %}

Nerwyn commented 2 months ago

It should be the same, you just have to switch to the YAML editor. Is it not working anymore?

joq3 commented 2 months ago

It should be the same, you just have to switch to the YAML editor. Is it not working anymore?

Sorry, my bad. it is still working. I thought it was not possible to do with the YAML-editor any longer.