Variable colours (cards, backgrounds, sidebar, ...)#361
Conversation
|
Hi @ahofelt, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
| transition: all 0.30s ease-out; | ||
|
|
||
| background-color: white; | ||
| background-color: var(--primary-background-color); |
There was a problem hiding this comment.
Lets keep default values:
background-color: var(--primary-background-color, white);
|
|
||
| app-header-layout { | ||
| background-color: #E5E5E5; | ||
| background-color: var(--paper-grey-200); |
There was a problem hiding this comment.
Create a separate variable.
If you want a green background here you wouldn't want to override paper-grey-200 to green,
|
You're right @andrey-git changed it now as you suggested. Added a |
|
If you want a proper dark theme you would need a few more adjustments, I don't have a fork right now so maybe you want to add this? in ha-sidebar: in home-assistant-main add: in ha-panel-dev-service change: ha-state-icon: The svg in state-history-chart-timeline might need some... for example: I think that would bring us pretty close. A few more thing to do in specific components probably. |
|
ha-media_player-card .controls { |
|
@bramkragten : Ok, going through them now -- but unsure on your |
|
Thats for all the text that does not have explicit styling, it now just takes the browser default which is black, we would need to set a text color at some high point, normally you would use the body. But figgered home-assistant-main was high enough and there the custom styles are set aswell... So I would suggest adding a style block? @andrey-git suggestions? |
|
As to ha-state-icon, the active state is actually in state-badge.html (currently: #44739E) and the inactive is somewhere in bower_components/paper-dialog/paper-dialog.html (isn't that outside our reach?). |
|
That would mean we could just define --paper-item-icon_-_color in our styles config, let me try that. State badge is found here: ha-state-icon { ha-state-icon[data-domain=binary_sensor][data-state=on],ha-state-icon[data-domain=light][data-state=on],ha-state-icon[data-domain=sun][data-state=above_horizon],ha-state-icon[data-domain=switch][data-state=on] { |
Yes, that's where it is defined as #44739E I added some more changes as you suggested. As to the changes in home-assistant-main, state-history-chart-timeline, and ha-state-icon/state-badge, I'm afraid that's beyond me for now.. |
|
The charts are a different story indeed, Google charts makes them, I believe you can set options with colors, but I'm not familiair with it. Also not the biggest problem right now. I'll look at the points left. Have to setup a development environment for the frontend... |
|
For the state cards, I would prefer a different variable; paper-card-background-color. Thanks for your work btw. I have my def env setup, tomorrow I'll get on to this. |
|
@ahofelt it looks like you're editing this via the GitHub online editor. Please test this locally. |
|
@bramkragten the problem is that CSS variables does not have functions that SASS has like |
@balloob yes that's correct. I'm just a beginner and have my difficulties in understanding it all. But I do test it all locally before mirroring the changes manually in the GitHub online editor. Not the most efficient way but it works for me for now. Triple-checked everything for consistency. All working perfectly well locally. And most of the recent changes have been suggested by @bramkragten and I merely copy (and test) them. Apologies for my ignorance. |
|
Alright, tested it locally and didn't see anything of the default theme be off, so all ok 👍 🐬 congratualtions on getting your first PR merged! 🎉 |
|
Wonderful news. Thanks all, @balloob and especially @bramkragten. Now, let's get theming! |
First contribution, apologies for any mistakes.
As discussed in the "Share your Themes thread": https://community.home-assistant.io/t/share-your-themes/22018/9?u=ahs.
Goal is to allow more flexibility with theming (allowing e.g. "night mode") by replacing some hardcoded values by variable colours (which can be defined in custom themes):
Note that the default paper-grey-200 is not exactly the same as the current colour (#E5E5E5) but is the closest match of the defined colours in ha-style.html. It will however lead to a slight recolouring of the default background.