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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

App lost the ability to switch theme in tandem with OS #163

Closed
andrecasal opened this issue Jun 11, 2023 · 2 comments
Closed

App lost the ability to switch theme in tandem with OS #163

andrecasal opened this issue Jun 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@andrecasal
Copy link
Contributor

Hey @kentcdodds 馃憢 On 07a355b removed the ability for the app to adapt to OS theme changes. If the user changes the OS theme, the app doesn't adapt anymore. Was this on purpose?

@onemen
Copy link
Contributor

onemen commented Jun 12, 2023

I see the same on Windows.

changing system theme only apply to the App after F5

more related issues:

  • switching theme in the App does not change the value of CH-prefers-color-scheme, is this by design ?, I only see a change in the _session cookie.
  • when user log out the App removes the _session cookie and the theme revert back to system theme from CH-prefers-color-scheme value.

@kentcdodds
Copy link
Member

kentcdodds commented Jun 12, 2023

You're right, that was a mistake. A fix has been pushed.

switching theme in the App does not change the value of CH-prefers-color-scheme

This is correct. That cookie value is only about what the user's prefers-color-scheme value is. That's the fallback value provided their preference is "system." Their preference is stored in the session.

when user log out the App removes the _session cookie and the theme revert back to system theme from CH-prefers-color-scheme value.

This is a good point. We should probably have a separate cookie for the user's color scheme preference. But it's not the same as CH-prefers-color-scheme. The distinction is important:

  1. CH-prefers-color-scheme: The user's system color scheme preference
  2. Our new cookie (maybe simply theme?): The user's preference for our app. When "system", we reference the CH-prefers-color-scheme value.

This So yes, this is a bug and should be fixed by adding a separate cookie for managing the theme. No need to sign it either. It can be a raw value.

@kentcdodds kentcdodds reopened this Jun 12, 2023
@kentcdodds kentcdodds added the bug Something isn't working label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants