Skip to content
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

Prevent darkMode overwrite by frontend_default_dark_theme #9519

Merged

Conversation

spacegaier
Copy link
Member

@spacegaier spacegaier commented Jul 7, 2021

Breaking change

Proposed change

The active this.hass.themeSettings.darkMode selection got incorrectly overwritten in the following edge case:

You have defined backend themes via frontend_default_theme and frontend_default_dark_theme and the OS is set to "dark preferred". The logic inside _applyTheme() first determines the correct active dark mode (and applies the matching theme variant), but then a few lines later it got overwritten to dark because darkPreferred and this.hass.themes.default_dark_theme were true while darkMode can correctly be set to false, but "looses" in the boolean "||" operation.

That meant that if you have selected the "light" radio box in the theme selection (while "Backend-selected" is the theme name), the overall theme was the light one (since it got applied a few lines after the initial correct darkMode determination), but inside this.hass.themeSettings.darkMode we had the wrong value.

This problem was noticeable if in that configuration you go the HA general settings and you see that despite the light theme being used, the map of the location editor was in dark mode (since unless the caller provides a fixed darkMode value, <ha-map> uses the this.hass.themes.darkMode).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bramkragten bramkragten merged commit 5a1070c into home-assistant:dev Sep 6, 2021
@spacegaier spacegaier deleted the backend-default-dark-fix branch September 6, 2021 12:02
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants