In the custom-bar
component, i was trying to add conditional colors as shown in the post below.
https://community.home-assistant.io/t/mushroom-cards-build-a-beautiful-dashboard-easily/388590/3248
in the part of the code which is as follows
- type: custom:bar-card
entity: sensor.furnace_filter_days_remaining
height: 42px
min: '0'
max: '182'
entity_row: true
severity:
- color: rgb(var(--mush-rgb-green))
from: 91
to: 182
- color: rgb(var(--mush-rgb-orange))
from: 21
to: 90
- color: rgb(var(--mush-rgb-red))
from: 0
to: 30
This part was always giving error and the color output was not generating. The bar was generating without any color.
In one of the subsequent replies to a similar query, the reply was to add the mushroom variables to the theme file.
https://community.home-assistant.io/t/mushroom-cards-build-a-beautiful-dashboard-easily/388590/3259
So i copied, all the variables mentioned in that page
starting with…
ha-card-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.16)
There were variables for colors also… like
mush-rgb-red: 244, 67, 54
mush-rgb-pink: 233, 30, 99
mush-rgb-purple: 156, 39, 176
mush-rgb-deep-purple: 103, 58, 183
mush-rgb-indigo: 63, 81, 181
mush-rgb-blue: 33, 150, 243
mush-rgb-light-blue: 3, 169, 244
mush-rgb-cyan: 0, 188, 212
etc
In another post later, i saw this
https://community.home-assistant.io/t/mushroom-cards-build-a-beautiful-dashboard-easily/388590/3839
It mentioned that
Thanks to @piitaya for adding all the Mushroom colors to HA as RGB variables. You don’t have to define them in your theme as mush-rgb-<color>
anymore, and you can use them with any card.
So i tried those --rgb-green-color
too in my code, but again there was no color generated.
Today, i saw your current code where you have mentioned
:host {
/* Define Person State colors. Can be added to theme */
--state-person-home: var(--green-color);
--state-person-not-home: var(--red-color);
--state-person-zone: var(--blue-color);
--state-person-unknown: var(--grey-color);
/* Set Person State color */
--state-person:
{% if is_state(config.entity, ['home', 'not_home', 'unknown']) %}
var(--state-person-{{ states(config.entity) | replace('_', '-') }})
{% else %}
var(--state-person-zone)
{% endif %};
when i used, the var(--green-color);
in my code, the colors were generated for the custom-bar component.