Skip to content
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] Update code snippet in docs for custom color palette #32946

10 changes: 10 additions & 0 deletions docs/data/material/customization/palette/palette.md
Expand Up @@ -87,6 +87,16 @@ const theme = createTheme({
// dark: will be calculated from palette.secondary.main,
contrastText: '#ffcc00',
},
// Provide every color token (light, main, dark, and contrastText) when using
// custom colors for props in Material UI's components.
// Then you will be able to use it like this: `<Button color="custom">`
// (For TypeScript, you need to add module augmentation for the `custom` value)
custom: {
light: '#ffa726'
main: '#f57c00',
dark: '#ef6c00',
contrastText: 'rgba(0, 0, 0, 0.87)',
}
// Used by `getContrastText()` to maximize the contrast between
// the background and the text.
contrastThreshold: 3,
Expand Down