Skip to content

Dark mode for mixins #45016

@nicolasfripp

Description

@nicolasfripp

Summary

if we want to customize the light/dark palette we can do somehthing like this:

 const theme = createTheme({
  ...otherOptions,
  colorSchemes: {
    light: {
      palette: lightPalette,
    },
    dark: {
      palette: darkPalette,
    },
  },
});

Then, if we do theme.palette.something.main the color is displayed depending on the mode.

It would be great if this also works for the mixins. That means if we use theme.mixins.something, it should adapt based on the mode (light or dark), instead of using theme.applyStyles for when we want to customize certain styles.

Examples

I expect something like this:

 const theme = createTheme({
  ...otherOptions,
  colorSchemes: {
    light: {
      palette: lightPalette,
      mixins: lightMixins,
    },
    dark: {
      palette: darkPalette,
      mixins: darkMixins,
    },
  },
});

Motivation

I want to avoid using too many theme.applyStyles to show one mixin or the other , depending on if we are using light or dark mode.

Search keywords: Dark mode mixins palette

Metadata

Metadata

Assignees

No one assigned

    Labels

    customization: themeHigher level theming customizability.support: questionCommunity support but can be turned into an improvement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions