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

Fix pick-theme-row and behavior of default theme mode #20783

Merged
merged 1 commit into from May 24, 2024

Conversation

karwosts
Copy link
Contributor

@karwosts karwosts commented May 12, 2024

Proposed change

I do not believe the Use default theme setting is currently working fully correctly.

For example, consider these two example themes from the website:

    happy:
      primary-color: pink
      text-primary-color: purple
    sad:
      primary-color: steelblue
      modes:
        dark:
          secondary-text-color: slategray

Say that user makes two service calls, and sets happy as the default light theme:

service: frontend.set_theme
data:
  mode: light
  name: happy

and sad as the default dark theme:

service: frontend.set_theme
data:
  mode: dark
  name: sad

My expectation now would be that in the user profile, the user can pick Use default theme from the theme picker, and then should see the Auto/Light/Dark radio set. When Light is selected, we should use happy theme. When Dark is selected, we should use dark-variant of sad theme. When Auto is selected, we would either use happy (if browser does not prefer dark) or dark-variant of sad (if browser prefers dark).

What currently actually happens:

  • if light mode is currently selected, the auto/light/dark radio set is not displayed, based on the fact that the default light mode theme (happy) does not have a dark mode. This seems wrong, and we should show the radio set due to the default theme having default light and dark modes defined. If dark mode is currently selected, we do see the radio set, but if you click on light, the set instantly disappears and you cannot go back to dark.

  • if light mode is currently selected, I would expect to see the happy theme applied. However the theme mixin is instead applying the light-variant of sad, due to my browser/OS setting is to prefer dark. Unless darkMode is set to Auto, I would not expect the browser preference to be considered.

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:

@piitaya piitaya merged commit 3c3d542 into home-assistant:dev May 24, 2024
14 checks passed
@karwosts karwosts deleted the fix-default-theme-mode branch May 24, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants