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
Store Dark Mode preferences in Local Storage #194
Comments
This would cause a FOUC (flash of unthemed content) when loading the website, which may not be desirable. Dark mode should stick around for local navigation between articles however, and only reset to light mode when reloading the page. FYI, the upcoming TypeScript release of ChakraUI is supposed to solve those FOUC colorMode issues. |
It wasn't working because I started binge-reading his articles bcz there were so good. And I have a habit of opening in It works while navigating as it should :) |
It turns out that dark mode is pretty tricky when using CSS-in-JS. To properly implement in, you likely need to use CSS variables as well. https://joshwcomeau.com/gatsby/dark-mode/ |
Yep already read Josh’s blog post & opened up an issue on Chakra UI a few days ago too. Not sure it’s solvable with Chakra chakra-ui/chakra-ui#908 (comment) |
can we make it so it gets system setting for dark/light mode? i'm having to set it to dark mode every time i open it up. |
@sarthaktexas ohh yeah i think that might work as chakra provides an option now with |
yup! should I make a pull request? |
@sarthaktexas I believe that will require updating Chakra to v1 – if you're open to that, I'd love assistance! |
@leerob Actually I don't think you need to do that, let me see what can I do |
@Rodman-Sw My point is that you shouldn't need to do anything custom once you upgrade to Chakra v1. Since I will be doing that eventually, I'd prefer to stick with that rather than something custom. Does that make sense? |
Hey @leerob I recently build a project with Next and Chakra UI with v1.0, today I just pushed the persisting of color mode on my project Github Emojis. If you are planning to upgrade Chakra-UI to 1.0, Do you mind I if try to implement the similar on leerob.io as well? |
Yeah, I'd love help migrating to v1! @AkashRajpurohit |
Fixed here -> #239 |
Otherwise I have to constantly switch dark mode on every article I click :)
The text was updated successfully, but these errors were encountered: