Change sub button background colour while on...not on and off #2132
Answered
by
johndoe0815
prestr
asked this question in
Questions about config, custom styles and templates
-
GoalI want to change the sub button background colours when the entities are on. Source Yamltype: custom:bubble-card
card_type: sub-buttons
button_type: switch
sub_button:
main: []
bottom:
- entity: light.basement_lights
show_name: true
- entity: switch.garage_lights
show_name: true
hide_main_background: true
rows: 0.938
card_layout: large
styles: |
* {
font-size: 14px !important;
}
.bubble-sub-button-1 {
background: rgba(250,150,50,0.5) !important;
}
.bubble-sub-button-2 {
background: rgba(500,1,50,0.5) !important;
}Which step did you already try?No response ProblemWhen I add the styling the background changes colour regardless if the entity is on or off. I want it to be the default grey when they are off. Read the documentation
|
Beta Was this translation helpful? Give feedback.
Answered by
johndoe0815
Jan 15, 2026
Replies: 1 comment 1 reply
-
|
Either you use one of the modules that allow this via GUI, or your code requires some if...then...else. Here is an example how you could change the background of a sub button depending on the state of an entity: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
prestr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either you use one of the modules that allow this via GUI, or your code requires some if...then...else.
Here is an example how you could change the background of a sub button depending on the state of an entity: