Last active
January 30, 2022 11:20
-
-
Save amitsinghrawat1994/31bd296ae051bf9729431712d79d02fd to your computer and use it in GitHub Desktop.
Add a custom variable in Material UI version 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add a custom variable in Material ui | |
| // ref: https://github.com/mui-org/material-ui/issues/13802#issuecomment-444200131 | |
| import createMuiTheme from "@material-ui/core/styles/createMuiTheme"; | |
| import { PaletteColor, PaletteColorOptions } from "@material-ui/core/styles/createPalette"; | |
| declare module "@material-ui/core/styles/createPalette" { | |
| interface Palette { | |
| blue: PaletteColor; | |
| } | |
| interface PaletteOptions { | |
| blue: PaletteColorOptions; | |
| } | |
| } | |
| export default createMuiTheme({ | |
| palette: { | |
| blue: { | |
| main: "blue" | |
| } | |
| } | |
| }); | |
| // Add CommonColors | |
| // Ref: https://stackoverflow.com/a/68433584 | |
| import "@mui/material/styles/createPalette"; | |
| declare module "@mui/material/styles/createPalette" { | |
| interface CommonColors { | |
| tan: string; | |
| lightRed: string; | |
| red: string; | |
| offBlack: string; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment