Loving Custom UI - just started using it. Thanks for the work.
You hinted on github that it is possible to change an icon color depending on state using rgb_color. I have a sensor that I would like to start using with Custom UI and I am not sure how to implement the color change - please can you help?
I would like the icon to be red if the door is open, and I intend to use Custom UI template attributes. Here is my current (pre Custom UI code):
I’m not sure that device_class quite does it. The only manual entry I can find is here and that neither mentions “door” (nor “window”) for binary_sensors, nor - more importantly - any possibility of changing color with rgb_color
But the template you sent works perfectly - thanks!
Can’t get this to work, and my “restart keys” are wearing out. Trying to change color deepening on sensor temperature. No result with my code. What am I doing wrong?
Looks like the rgb_color works only on the icon (-for me) when in a group, not the text. The rgb_color works not for the sensor when on the default view.
Do you know if there are a code for the color within the default sensor view?
Yeah if you use “rgb_color” as shown in my second post, it will only change the icon colour when in the group.
If you use “theme” as shown in my first post, it will change the colour of the badges (the circular representations shown in your second image). If you then add it to a group, whilst using theme, it will change the icon, text and value, as I show in the first image of my second post!
To use theme, you need to define the colours under the theme section of the front end - I’m at work now, but when I get home I will post that config for you.
Don’t worry, it confused the hell out of me (I find CustomUI incredibly confusing as it is!), so am happy to help!
well, almost. Havent found a way to distinguish between border colors of the badge and label. Also, no changing of the label text is possible (yet). Other than that, most things can be customized…
for the badges i use my dedicated frontend themes file, you might be able to adapt it to your own likings:
##########################################################################################
# Badge-themes in order of severity, either up or down
##########################################################################################
#source https://github.com/home-assistant/home-assistant-polymer/blob/master/src/resources/ha-style.html
# /* for label-badge */
# --label-badge-background-color: white;
# --label-badge-text-color: rgb(76, 76, 76);
# --label-badge-red: #DF4C1E;
# --label-badge-blue: #039be5;
# --label-badge-green: #0DA035;
# --label-badge-yellow: #f4b400;
# --label-badge-grey: var(--paper-grey-500);
green_badge:
label-badge-red: green
label-badge-border-color: lightgrey
label-badge-background-color: white
label-badge-text-color: green
# label-badge-blue: blue
# label-badge-green: black
# label-badge-yellow: yellow
# label-badge-grey: grey
grey_badge:
label-badge-red: grey
label-badge-border-color: lightgrey
label-badge-background-color: white
label-badge-text-color: grey
black_badge:
label-badge-red: black
label-badge-border-color: lightgrey
label-badge-background-color: white
label-badge-text-color: black
brown_badge:
label-badge-red: brown
label-badge-border-color: brown
label-badge-background-color: white
label-badge-text-color: brown
orange_badge:
label-badge-red: orange
label-badge-border-color: orange
label-badge-background-color: white
label-badge-text-color: orange
blue_badge:
label-badge-red: blue
label-badge-border-color: blue
label-badge-background-color: white
label-badge-text-color: blue
yellow_badge:
label-badge-red: grey
label-badge-border-color: yellow
label-badge-background-color: lightgrey
label-badge-text-color: yellow
red_badge:
label-badge-red: grey
label-badge-border-color: lightgrey
label-badge-background-color: white
label-badge-text-color: red