-
-
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
[Material] [CssVars] --AppBar-color
is invalid when dark color scheme is deleted
#36125
Comments
It does not work because If anyone wants to contribute, here is one way to fix it: diff --git a/packages/mui-material/src/AppBar/AppBar.js b/packages/mui-material/src/AppBar/AppBar.js
index f68b30d817..c554d23751 100644
--- a/packages/mui-material/src/AppBar/AppBar.js
+++ b/packages/mui-material/src/AppBar/AppBar.js
@@ -20,7 +20,7 @@ const useUtilityClasses = (ownerState) => {
// var2 is the fallback.
// Ex. var1: 'var(--a)', var2: 'var(--b)'; return: 'var(--a, var(--b))'
-const joinVars = (var1, var2) => `${var1?.replace(')', '')}, ${var2})`;
+const joinVars = (var1, var2) => (var1 ? `${var1?.replace(')', '')}, ${var2})` : var2);
const AppBarRoot = styled(Paper, {
name: 'MuiAppBar',
@mwskwong You will also need to have const theme = extendTheme({
colorSchemes: {
light: {
palette: { // <<< without `palette`, it will not work even with the above fix.
AppBar: {
defaultBg: "red"
}
}
}
}
}); |
I'd like to take on this one. Just to discuss: can we |
Yeah, this is exactly what I was trying to say. I should have stated that explicitly in the OP to save for all the trouble of re-investigation. |
Regarding the path: we have |
BTW, from my point of view as a user, omitting the |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
Current behavior 😯
Overriding the
defaultBg
renders no effect because the computed--AppBar-color
is invalid after dark color scheme is deletedExpected behavior 🤔
This should set the default AppBar color to red.
Context 🔦
Workaround
Applying the color in the
MuiAppBar.styleOverrides
.Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: