-
Notifications
You must be signed in to change notification settings - Fork 673
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 media query value when useColorSchemeMediaQuery is set to 'system' #1981
Use media query value when useColorSchemeMediaQuery is set to 'system' #1981
Conversation
And save to localStorage even if useColorScheme...: true, to make the flash prevention script work.
…-media-query-api-update
… types I felt that 'system' made a bit more sense here (over 'live') as we want to use the system color mode preference
implemented julianbenegas changes in the new index tsx file for color-modes
…eMediaQuery setting
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/systemui/theme-ui/HJc47wRw1gg8YDBqzeMCbiFVcipX |
…sting behaviour We only want it to ignore the stored value when useColorSchemeMediaQuery is system
Wow, phenomenal work!! Haven't tested it out but looks great. Super appreciate the contribution. |
Thanks! I'm loving the library so wanted to see if I could contribute. Keep up the great work!! |
Great PR @draekien! Thank you for the contribution! |
Co-authored-by: Piotr Monwid-Olechnowicz <hasparus@gmail.com>
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.
Tried this locally & works exactly as I'd expect!
🚀 PR was released in |
This PR is based on the changes proposed in #981 and fixes #787
This change adds a new option for
useColorSchemeMediaQuery
called'system'
which willlisten for changes to the
prefers-color-scheme
media query and update the color modeaccordingly.
This change also updates the documentation to include a short description for the
'system'
option.I decided to go with
'system'
over'live'
as I've mostly encountered websites referring to theuser's preferred color scheme as the 'system' setting. Let me know if you would prefer
'live'
instead.Testing:
'system'
Testing:
'initial'
|true