-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add system to ThemeSwitch #699
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @timlrx on Vercel. @timlrx first needs to authorize it. |
Hi @pavelzw, thanks for the contribution. I intentionally did it this way - by default it follows your system theme but once a user selects a preference, I don't see a situation where the user would revert back to system instead of just switching to the preferred theme. Happy to link your blog instead in the examples list for a reference to the implementation for those that might prefer it this way. |
Hi @timlrx, what about if they clicked dark/light out of curiosity, then decided they won't it to go with their system. For example, on my Mac I have it set to switch to dark mode at sunset, then light mode at sunrise. Am I explaining the scenario well? In this situation, I would be annoyed with the site if I couldn't switch to 'System'. |
@Mood93 Did not realised that's how auto works on the Mac. I am convinced by your argument and it appears the upvotes tilt in favour of supporting it as well 😄 @pavelzw do you mind handling the merge conflict? You could use |
yeah, I can take a look at it later 👍🏻 |
0b7403f
to
9f6ef66
Compare
@timlrx ready for review |
9f6ef66
to
6b4832d
Compare
@timlrx what's the status of this PR? From my side it can be merged. |
Apologies for the delay! I have merged it in. Thanks for the contribution! |
The current implementation doesn't allow changing back to system once you changed the theme once since it's stored in localstorage by
next-themes
. This PR adds aRadioGroup
to choose from all three states similar to https://tailwindcss.com/.For an example of how this looks like in action see https://pavel.pink/ / https://github.com/pavelzw/blog
Bildschirmaufnahme.2023-08-26.um.14.46.21.mov