Add support for custom themes to use dark mode#8347
Merged
spacegaier merged 27 commits intohome-assistant:devfrom May 25, 2021
Merged
Add support for custom themes to use dark mode#8347spacegaier merged 27 commits intohome-assistant:devfrom
spacegaier merged 27 commits intohome-assistant:devfrom
Conversation
spacegaier
commented
Feb 8, 2021
21 tasks
bramkragten
reviewed
Mar 9, 2021
|
|
||
| if (changedProps.has("hass")) { | ||
| const oldHass = changedProps.get("hass") as HomeAssistant | undefined; | ||
| if (!oldHass || oldHass.themes?.darkMode === this.hass.themes?.darkMode) { |
Member
There was a problem hiding this comment.
Why is this no longer needed? We still init themes as null?
Member
Author
There was a problem hiding this comment.
Should not have been needed before the PR either. Basically no usages of hass.themes do check via ? (e.g. none of the cards do).
bramkragten
reviewed
Mar 9, 2021
| if (key === "selectedTheme" && typeof value === "string") { | ||
| value = { theme: value }; | ||
| } | ||
| // selectedTheme was renamed to selectedThemeSettings on 20210207 |
bramkragten
reviewed
Mar 9, 2021
| states: null as any, | ||
| config: null as any, | ||
| themes: null as any, | ||
| selectedThemeSettings: null, |
Member
There was a problem hiding this comment.
Shouldnt selectedTheme be removed if we are going to rename it?
Member
Author
There was a problem hiding this comment.
selectedTheme is not in this structure init, therefore cannot be removed here. Or am I missing your point?
bramkragten
reviewed
Apr 26, 2021
bramkragten
reviewed
Apr 26, 2021
bramkragten
reviewed
Apr 26, 2021
bramkragten
reviewed
Apr 26, 2021
bramkragten
reviewed
Apr 26, 2021
bramkragten
reviewed
Apr 26, 2021
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
bramkragten
reviewed
May 24, 2021
bramkragten
reviewed
May 24, 2021
bramkragten
reviewed
May 24, 2021
bramkragten
reviewed
May 24, 2021
bramkragten
reviewed
May 24, 2021
bramkragten
reviewed
May 24, 2021
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
bramkragten
approved these changes
May 25, 2021
Member
bramkragten
left a comment
There was a problem hiding this comment.
OK to merge when documentation is added
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Not breaking, since legacy theme (= implicit light mode only) format is still supported.
Proposed change
Backend PR: home-assistant/core#46532
Adds the option for custom themes to be based upon the dark mode. A theme can now specify support for both light and dark mode and the user can select which one to use (same behavior as for the "default" theme mode selection).
This PR also renames the local storage parameter "selectedTheme" to "selectedThemeSettings" (to underscore that it does not only contain a theme name, but all related user defined settings) including an automatic migration for the old key storage.
This change also allows the user to specify default color values for light and dark mode forprimary_colorandaccent-color. If provided, the same color pickers currently used by the "default" theme will be shown and users can adjust as desired.Reverted from MVP
Type of change
Example configuration
Below the different test themes used in the GIF above to go through the different scenarios.
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: