Hey everyone! I’m trying to customize the color of my dashboard button icons based on the TV source. My goal is to have the icon highlight when the TV is set to the specific source associated with that button. Here’s what I’ve tried so far:
yaml
type: custom:button-card
entity: media_player.lg_robbert
icon: mdi:sony-playstation
name: PS5
show_name: true
color: |
[[[
if(entity.attributes.source == “HDMI 2”){
return ‘rgb(33, 235, 144)’;
} else{
return ‘rgb(68, 115, 158)’;
}
]]]
tap_action:
action: call-service
service: media_player.select_source
service_data:
source: HDMI 2
entity_id: media_player.lg_robbert
However, the icon color remains black. I’m not sure what I’m missing here. Does anyone have experience with dynamic color changes in button cards? Any tips or insights would be greatly appreciated!
Also, if anyone has successfully implemented similar customizations, I’d love to hear about your setup and any challenges you faced. Let’s brainstorm together!
Cheers,
[Your Name]