Skip to content
Discussion options

You must be logged in to vote

While not perfect, I've had success capturing the user's theme to a cookie and reading from that during SSR. This also lets the user toggle light vs dark for your site independent of system settings if this becomes the source of truth for the client side rendering as well.

If you use google.com's automatic theming based on system settings, you'll notice it occasionally also picks light mode when it should have been dark, but sticks with the theme chosen by SSR in those instances. A hard refresh brings back dark mode ssr and csr.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zoontek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants