#Use Template card values in styling
1 messages · Page 1 of 1 (latest)
what i currently have is this ```type: custom:mushroom-template-card
primary: Bedroom
icon: mdi:bed
secondary: ""
tap_action:
action: navigate
navigation_path: "#bedroom"
icon_color: red
badge_icon: |-
{% if states('input_boolean.bedroom_quiet_time') == 'on' %} mdi:home-sound-in
{% endif %}
badge_color: ""
card_mod:
style: |
ha-card {
border-radius: 100px;
}
ha-card:active {
background-color: rgba(var(--rgb-icon-color), 0.2); 0.2);
}
ha-card:hover {
**background-color: rgba(0, 0, 0, 5);
}
but this is just black not the actual colour of the icon
I think I see what you're trying to do. In this example, you're expecting the background color to be a shade of red based on the icon color. A couple of things come to mind:
- I don't know if an element in the card can reference other another element. (I could be mistaken on that, though.)
- The
--rgb-icon-coloris a variable that would be defined in your theme. It is not the color of the icon that is in the card. - I'm not positive, but I think you have the alpha set twice (the
0.2);). Try getting rid of one of those.
I have an example on my Github that uses card_mod to change the background color of a button card. While it is not exactly what you're going for, I think it could be a useful reference.
Card modding a button card to reflect the background as light's RGB