Skip to content

Problems to implement a specific behaviour of color-scheme #1584

Answered by rtivital
michaelhuber1937 asked this question in Q&A
Discussion options

You must be logged in to vote

To avoid flickering, you need to store value in cookie – https://mantine.dev/theming/dark-theme/#save-color-scheme-in-cookie
There is no way of knowing user preferred color scheme with initial request, so you will have to save this value in a cookie on initial render and then use this value for next requests. There is no way to avoid initial flickering if you want to rely on user preferred color scheme, I can only advise to pick color scheme that you like and use it as initial value and then let user decide which color scheme he wants.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@kwiat1990
Comment options

@kwiat1990
Comment options

@rtivital
Comment options

@kwiat1990
Comment options

@rtivital
Comment options

Answer selected by rtivital
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants