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

[system] Replace enableSystem with defaultMode #33960

Merged
merged 2 commits into from Sep 20, 2022

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Aug 17, 2022

BREAKING CHANGE

enableSystem has been replaced with defaultMode to make it possible to force the dark mode initially.

getInitColorSchemeScript({
-  enableSystem: true,
+  defaultMode: 'system',
})

Found the issue while writing the doc in #33958.

Currently, it is not possible to initially force dark mode. The fix is to follow the props in CssVarsProvider by replacing enableSystem with defaultMode.

// developer can pick the default mode that they want

// This means the initial color scheme will be the same as user's system preference
getInitColorSchemeScript({ defaultMode: 'system' })

// This means the initial color scheme will be the dark color scheme
getInitColorSchemeScript({ defaultMode: 'dark' })

@siriwatknp siriwatknp added new feature New feature or request package: system Specific to @mui/system labels Aug 17, 2022
@mui-bot
Copy link

mui-bot commented Aug 17, 2022

Details of bundle changes

Generated by 🚫 dangerJS against c0b607b

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks good, please add a BREAKING CHANGE description and label before merging.

@siriwatknp siriwatknp merged commit 46838b7 into mui:master Sep 20, 2022
alexfauquette pushed a commit to alexfauquette/material-ui that referenced this pull request Oct 14, 2022
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change new feature New feature or request package: system Specific to @mui/system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants