Skip to content

CreateTheme: MUI 6: how to combine colorSchemes with theme.palette.augmentColor(...) #44351

@wouter-leistra

Description

@wouter-leistra

We are updating our MUI material UI theme to follow version 6 recommendations and stumbled upon the documentation that colorSchemes is the preferred way going forward. I adjusted my theme with light and dark themes palettes but we have some custom colors we like to augment. The documentation on augmentColors specifies to use the initial theme to create an updated theme with createTheme(theme, {...}) where you specify the custom colors. But I don't get it to work with dark and light theme palettes for these custom colors as specifying just palette on the second theme creation overrides the initial theme as stated in the documentation and spreading theme.colorSchemes.light.palette gives TypeScript errors that Theme doesn't have this property.

Can someone help me to find a way to get custom augmented colors to work with colorSchemes for light and dark?

Search keywords:

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions