I'm trying to extend the color palette that mui provides. The overriding of primary, secondary etc colors works well but if I want to create a custom set of colors just after, I can't figure out how to make it works. There are plenty of examples without typescript but when this guy comes into the game it makes it trickier. Let's say I have this:
theme.tsx
palette: {
primary: {...}, // override works
custom: {
main: 'color',
dark: 'color1',
light: 'color2',
contrastText: 'color3'
}
}
from what mui document says, I should use module augmentation:
declare module "@material-ui/core/styles/createPalette" {
interface Palette {
custom: Palette['primary'];
}
interface PaletteOptions {
custom: PaletteOptions['primary'];
}
}
Nothing is yelling, but when I use it for a Box component for example, it doesn't work (others like primary.dark works well). It's been several days that I'm trying to find out how to do this, but I have to say I'm out of knowledge there.
I'd appreciate some help! Thanks! :)
Ps: Someone already posted the same question but it didn't help me here