-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
Closed
Labels
customization: themeHigher level theming customizability.Higher level theming customizability.support: questionCommunity support but can be turned into an improvement.Community support but can be turned into an improvement.type: bugIt doesn't behave as expected.It doesn't behave as expected.v6.x
Description
Sorry if there's a better location to ask this and feel free to move it wherever.
We've recently updated from v5.16.7 up to 6.0.0 and would like to use css-variables, but ideally without having to populate createThemes with a light and dark mode palette.
theme.tsx
export const theme = createTheme({
cssVariables: {
colorSchemeSelector: '.theme-%s',
},
colorSchemes: { light: true, dark: true },
breakpoints: {
values: {
xSmall: 0,
small: 600,
medium: 960,
large: 1280,
xLarge: 1440,
xxLarge: 1920,
// generic device sizes
mobile: 425,
tablet: 640,
laptop: 1024,
desktop: 1280,
},
},
typography: {
fontFamily: 'var(--font-family)',
},
});styles.scss
.theme-light {
--mui-palette-primary-main: red;
--mui-palette-primary-dark: maroon;
}
.theme-dark {
--mui-palette-primary-main: olive;
--mui-palette-primary-dark: green;
}If we update the styles.scss with a new value and HMR updates the page, we are able to see the correct color, but as soon as we refresh the page, the colors will default back to their stock values:
<Button variant="contained" color="primary" type="submit" disabled={isSubmitting}>
Submit
</Button>Is there a way to be able to accomplish this, or will the mui generated css variables always override those in styles.scss.
Search keywords:
Metadata
Metadata
Assignees
Labels
customization: themeHigher level theming customizability.Higher level theming customizability.support: questionCommunity support but can be turned into an improvement.Community support but can be turned into an improvement.type: bugIt doesn't behave as expected.It doesn't behave as expected.v6.x
Projects
Status
Done
