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

[material-ui] Attach default light color scheme when enabling CSS theme variables #43493

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

siriwatknp
Copy link
Member

Issue

According to the docs, the code below should use @media (prefers-color-scheme: dark) for dark color scheme

const theme = createTheme({
  cssVariables: true,
  colorSchemes: { dark: true },
});

The colors are generated for both color schemes but the selector for dark palette is not using @media (prefers-color-scheme).

Fix

Set colorSchemes.light = true if no palette is provided. A test added.

@siriwatknp siriwatknp added bug 🐛 Something doesn't work package: material-ui Specific to @mui/material customization: theme Centered around the theming features labels Aug 28, 2024
@siriwatknp siriwatknp enabled auto-merge (squash) August 29, 2024 12:42
@mui-bot
Copy link

mui-bot commented Aug 29, 2024

Netlify deploy preview

https://deploy-preview-43493--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 14028b4

@siriwatknp siriwatknp merged commit 975ecbb into mui:master Aug 29, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work customization: theme Centered around the theming features package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants