Skip to content
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

Adding prefersColorScheme option to theme provider to select the system default #93

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

corbanbrook
Copy link
Collaborator

By default we don't use prefers-color-scheme to select the theme as we wish to default to the branded dark theme for first time visitors and only use light theme if they specifically set it throught the useTheme hook. But some applications using the design system may not want this same behavior so now ThemeProvider accepts prefersColorScheme={true} to select the system default. Note: This only works if there is NOT an already persisted theme selected by the user.

<ThemeProvider prefersColorScheme>
...
</ThemeProvider>

@corbanbrook corbanbrook merged commit 248f43f into master Nov 8, 2024
1 check passed
@corbanbrook corbanbrook deleted the prefers-color-scheme branch November 8, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant