-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set button colour to match active light colour #32
Comments
Can you provide some screenshots of what you are describing, please? I think I am following, but I want to be sure. |
I ‘ve worked out how to change a specific button’s colour depending on state, but somewhere there is a variable holding a light’s active colour when it’s turned on. That’s what I’m looking for, the variable. On other things it’s var(--button-card-light-color) but that doesn’t work here. |
The card colors are hard-coded in the CSS via card-mod using the variables. So you would probably need to apply some custom CSS to the cards themselves with card-mod (this is the basic functionality of card-mod, as opposed to the entire theme as has been done with LCARS). |
Hi, yes I get that - I can do it all (apply a colour/border depending on the state (on/off) of the light - what I can't find out is the variable which holds the current colour of the light. It must be built-in to Home Assistant somehow? |
card_mod: I want to replace 'gold' with the light's colour. |
Something like this:
|
Hi,
|
Hi - thanks for this. I can actually do that already. What I really wanted was to set the button colour to that of the light, which I can do outside of the theme 😄
On 7 Jul 2023, at 08:10, Mihai ***@***.***> wrote:
Hi,
I have something like this.
It changes if its ON = yellow and OFF = RED.
Code is below the screenshot
[image]<https://user-images.githubusercontent.com/31653632/251664739-b029aa61-d27d-4e29-80d0-9072ab8fe080.png>
type: horizontal-stack
cards:
* show_name: true
show_icon: false
name: Server Room
type: button
tap_action:
action: toggle
entity: light.it_room_5afc8b25_on_off
icon_height: 50px
show_state: true
card_mod:
class: button-capped
style: |
ha-card.button-capped {
{% if is_state('light.it_room_5afc8b25_on_off', 'on') %}
background-color: #ffcc33;
color: black;
{% else %}
background-color: #dd4444;
color: black;
{% endif %}
}
—
Reply to this email directly, view it on GitHub<#32 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AL5ZTQKB6YF23TZQMHILYETXO6Y55ANCNFSM6AAAAAATWLLMT4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@Xiondewah, sorry for the late late answer...here are the modifications that I also did in my system.
|
Brilliant! Thanks 😁
Message ID: ***@***.***>
|
On other cards (custom-button) I am able to change the colour of the button to match that of the light when it is turned on.
This involves using 'state' and a variable which holds the colour of the light when it is turned on.
Am I able to do this on LCARS please and, if so, how? I've scoured the web but can't find anything which pulls in that colour variable.
Many thanks.
The text was updated successfully, but these errors were encountered: