-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[docs] Adding custom light and dark themes always render dark theme #43533
Comments
Can you try this in your package.json? -"@mui/material": "6.0.1",
+"@mui/material": "https://pkg.csb.dev/mui/material-ui/commit/3df87c53/@mui/material", |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @karolis-666! How was your experience with our support team? |
Made a quick repro Did not worked. Made separate themes, but dark theme is always active |
@siriwatknp Yes, I tried it as well, but it didn’t work... |
@karolis-666 I found this workaround from another source, and it's working. |
Thanks, this workaround seems to work! |
Never mind, while it worked in development, there were some issues with colors after building the app. Is this method expected to be used for theming, or should a different approach be used now? |
That |
Thanks for asking. It's explain in the docs, is there anything we could make it clearer? |
You want to know what's particularly galling, but I have that very section on an already open tab, I didn't even have to scroll to see it, and I'd still managed to miss it. I saw the bit about calling I do think that it working for about half a day and stopping working sent me off on the wrong track for a long time, and that is likely the cause, I've got no real explanation for that. Anyway, on rereading the docs for this, they seem completely reasonable. I do sort of question why one of these approaches, say |
I think I found part of the root of my confusion, and it's this https://mui.com/material-ui/customization/dark-mode/#toggling-color-mode - which suggests that you can manually control the mode but makes no mention of needing to set |
Thanks for the feedback. The I think it'd be helpful to display warning when |
Related page
https://mui.com/material-ui/customization/dark-mode/
Kind of issue
Unclear explanations
Issue description
We have a lot of custom props used in
palette
to extend available color schematics. Now we are trying to figure out how to also implement dark mode in the same way.Now we check current theme with
const { mode, setMode } = useColorScheme();
and we get correct theme andsetMode
is also working as expected.Also with
const { palette } = useTheme()
from@mui/material
we get the correct palette, so it seems alright.So where is the issue? The App in light mode does not use
light: { palette: palette },
, but usesdark: { palette: paletteDark }
. It's a little bit unclear what correct approach should be to implement different theming, when our palette's are not just modifyingprimary, secondary, etc.
colors, but adding various custom new props. We get from useColorScheme that we are in light mode, useTheme returns correct light mode palette, but apps renders darkTheme anywayContext
Custom light and dark theming. Here is an example of our light palette how we declare it
Search keywords: theme, dark theme, light theme
The text was updated successfully, but these errors were encountered: