-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] getColorSchemeSelector() move away from data-color-scheme "attribute value" selector #42887
Comments
Noted. Will do some benchmark between |
I would recommend watching the whole video. There are interesting parts:
|
I'm transferring this to Pigment CSS repository. While there is still discussion about either MUI System and Pigment CSS should be the same thing, or separate (in which case define if it's in Material UI or in Pigment CSS product), for dark mode there isn't much we can do, Pigment CSS needs to be aware. |
I'm transferring back to the core repo because it's MUI System related and it will be closed by #42839 |
@siriwatknp Ok, maybe this API is indeed too opinionated for Pigment CSS. MUI System, or whoever we end up calling it, would be its sweet spot. What I want us to moved toward is for it to definitely not be exported from -import { CssVarsProvider, extendTheme } from '@mui/material/styles';
+import { CssVarsProvider, extendTheme } from '@mui/system/CssVarsProvider';
+import { mdTheme } from '@mui/material/mdTheme';
const theme = extendTheme({
+ ...mdTheme,
colorSchemes: { dark: true },
});
function App() {
return <CssVarsProvider theme={theme}>{/* ...you app */}</CssVarsProvider>;
} Material UI v6 could have been this opportunity, but we can make it v7, another small iteration change. |
Steps to reproduce
See https://youtu.be/nWcexTnvIKI?si=akGrAE59cm7py1Sl&t=1223
for why this might not be great:
material-ui/packages/mui-joy/src/styles/extendTheme.ts
Lines 632 to 635 in 94fcd3a
Current behavior
Selector use data attribute value
Expected behavior
Selector use data attribute or class name
Context
For comparison:
Your environment
npx @mui/envinfo
Search keywords: data-color-scheme
Search keywords:
Search keywords:
The text was updated successfully, but these errors were encountered: