Cannot override default dark mode theme #43583
Labels
customization: theme
Centered around the theming features
package: system
Specific to @mui/system
status: waiting for author
Issue with insufficient information
Steps to reproduce
Stackblitz code recreation
Steps:
ColorSystemOptions
objects with no custom colours or tags.in
createThemewhich points to both light and dark
ColorSystemOption` objects.palette
object increateTheme
to override an options defined in both light and dark theme.Current behavior
Using
useTheme
from"@mui/material"
shows that thepalette
objects for both light and dark contains all of the color tags (i.e.,primary
,secondary
, etc) but also apalette
attribute as well. Its this palette attribute that points to the palettes provided incolorSchemes
increateTheme
. As a result, dark and light mode dont use the palettes provided incolorSchemes
.However, what is stranger is that light mode will use the fallback palette options defined in
palette
ofcreateTheme
but dark mode wont. Instead, dark mode will use its default values.Expected behavior
Providing palettes to
colorSchemes
should override the default palette options and providing a palette to thepalette
attribute ofcreateTheme
should override all colours.Using the code environment above, switching from light to dark mod3 changes the button colour from purple to blue when they should stay purple.
Context
I am creating a toggle which allows the user to use either light, dark, or system colour theme. Light mode uses by provided palette but dark mode wont despite it being provided.
Your environment
npx @mui/envinfo
Search keywords: override default dark mode
The text was updated successfully, but these errors were encountered: