-
I am looking to change the colour icons (or appearance in general) on the remote card depending on the state of an entity. If it possible to have if else statements inside the Appearances -> CSS styles area, or more generally in the YAML, or a different way to do it altogether? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The Appearance CSS Styles codebox would be the correct area. You can include CSS with templates either here in the General tab or in the Elements tab with a custom element that overwrites/inherits from a default element. Every field is templatable, so you can wrap these styles in templates to only apply on entity states. You can also reference the card config fields (or custom element individual config) using {% if is_state(config.media_player_id, "on") %}
#power::part(icon) {
color: var(--red-color);
}
{% endif %} See this section in the README for more information on CSS styles in the general tab, this section for custom element appearance options, and this section for more information on template support in this card. |
Beta Was this translation helpful? Give feedback.
The Appearance CSS Styles codebox would be the correct area. You can include CSS with templates either here in the General tab or in the Elements tab with a custom element that overwrites/inherits from a default element.
Every field is templatable, so you can wrap these styles in templates to only apply on entity states. You can also reference the card config fields (or custom element individual config) using
config
in templates as shown below. This style in the general tab appearance CSS styles field would color the power button when the configured media player is on.See this se…