-
Notifications
You must be signed in to change notification settings - Fork 917
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
use next-themes for handling theme #712
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice job @technophile-04 exploring this option! 🙌
It's working great to me in both Dark and Light OS 👌
I had a super small issue in your deployed example, where the day/night radio button was moving a few pixels above the initial render when doing F5. In localhost it was working fine, and when I deployed to Vercel it was working fine too. Not big deal anyways, was only happening when forcing the refresh, not when changing tabs.
Ohh yeah, actually saw it was not happening on localhost more importantly on Screen.Recording.2024-02-11.at.1.57.09.AM.movBut fixed at 677cd37 by giving it some definite height so that it doesn't change Here is test app https://usehooks-ts-test.vercel.app/ Thanks Pablo 🙌 |
Nice catch and fix! |
completely agree with you here #707 (comment)
tested it and works great for me |
Description
Background #707, This works nicely and also fixes the flickering issue.
next-themes
seems like an popular library and used by ShadCn and NextUIThis also fixes #709
Test App : https://usehooks-ts-test.vercel.app/
the only downside is currently it does not hot react to theme changes of system preference (at the OS level). Although can be easily handled if we give the user an extra choice "System" instead of only 2 :
PS: It defaults to user's OS theme when user very first time visit the website, after that if he switches the theme manually then it doesn't react to OS changes