T
TanStack5mo ago
rare-sapphire

Dark mode color scheme

Hi ! I saw this https://github.com/sergiodxa/react-router-color-scheme-example on x. I was using the script trick to handle flash of uncorrect theme. The solution that I use is with react query https://github.com/KirdesMF/tss-color-scheme, but I don't know if this can be simplified or if you have other solution to that. Actually it works as expected. Thanks
GitHub
GitHub - sergiodxa/react-router-color-scheme-example
Contribute to sergiodxa/react-router-color-scheme-example development by creating an account on GitHub.
3 Replies
rare-sapphire
rare-sapphireOP5mo ago
I use react query because it helps to invalidate the color scheme, so I want to know if there is other way to "invalidate" or handle the update of the cookie
harsh-harlequin
harsh-harlequin5mo ago
Any reason you're not using next-themes? It should work just as fine with TSS If you encounter issues with it, there is this theme provider you can make and wrap your app with rather. https://gist.github.com/WellDone2094/16107a2a9476b28a5b394bee3fa1b8a3
rare-sapphire
rare-sapphireOP5mo ago
My point is to not use a script and just rely on css. I have already something working with the script tag.

Did you find this page helpful?