Comments (2)
This is because getColorSchemeSelector
is appended by CssVarsProvider
because the function needs attribute from CssVarsProvider's props.
I think we can improve this by delegating the attribute to the extendTheme
and set getColorSchemeSelector
to the theme. With this, zero-runtime can read and use the attribute
internally cc @brijeshb42
from material-ui.
Thank you for providing feedback.
If we can deliver in extendTheme
instead of under CssVarsProvider
then customization will be better
Currently I can temporarily rewrite the getColorSchemeSelector
function for use:
export function getMode(mode) {
if (mode === 'light') {
return `[data-mui-color-scheme="light"] &`;
}
return `[data-mui-color-scheme="dark"] &`;
}
But I realized other functions like pallet also don't work inside extendTheme
like Mui Joy.
My need is to customize the theme before creating in <CssVarsProvider theme={theme}>
So I need properties like mode (console.log("palette", theme.palette.mode);
)
There is also solution for this using global state. But then const { mode, setMode } = useColorScheme();
will lose its meaning and we have to write some extra code to further handle the mode
state, which is not necessary
Hopefully this will improve.
from material-ui.
Related Issues (20)
- [material-ui][Container] `maxWidth` doesn't have all types HOT 2
- [material-ui][Rating] Sizes demo not working as expected HOT 7
- [joy-ui][Drawer] Add a dedicated z-index in the default theme
- [joy-ui] JoyToggleButtonGroup key not included in components type HOT 1
- [material-ui][Text Field] `autoFocus` prop not working consistently with a Next.js App Router project HOT 3
- [docs-infra] Fix algolia links to API props
- [material-ui][Menu] Docs suggests using null anchors which alters container behavior in unpredictable ways
- [material-ui][Popover] Incorrect position of menu, popover and select when zoom is applied HOT 4
- [material-ui][Link] Default theme error when color is set to info HOT 4
- [material-ui][Dialog] Not able to remove the box-shadow HOT 2
- [material-ui][Menu] Text on the menu item moving slightly on hover HOT 1
- [material-ui] `important` in the Tailwind config not working
- [material-ui] Add v6 components props and classes deprecations HOT 7
- @mui/utils ^5.15.3 Install Failure
- [material-ui][docs] Broken demo in the Progress page in the Material 3 section HOT 2
- Typescript broken in latest release `ElementType` requires between 0-1 type arguments HOT 8
- [material-ui][Tabs] Scrollable variant slow animation on iOS and don't set click during it HOT 2
- [material-ui][Select] Does it receive different types of value? HOT 2
- [material-ui][docs] The instructions on the Next.js App Router guide do not work HOT 2
- [CSP style-src] MUITabs and some other component have inline styles not nonced by the CreateEmotionCache HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-ui.