Last active
December 4, 2021 19:12
-
-
Save Momotoculteur/f164a7115799a3602185b4d60ccc526b to your computer and use it in GitHub Desktop.
custom dark light theme switch system for react app build with material ui design
This file contains 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
import { createTheme } from "@material-ui/core/styles" | |
const LOCAL_STORAGE_KEY = "isDark"; | |
const baseTheme = createTheme({ | |
typography: { | |
fontFamily: "'Work Sans', sans-serif", | |
fontSize: 14, | |
fontFamilySecondary: "'Roboto Condensed', sans-serif" | |
} | |
}) | |
const DARK_THEME = createTheme({ | |
...baseTheme, | |
palette: { | |
type: "dark", | |
primary: { | |
main: '#5c85ff', | |
}, | |
secondary: { | |
main: '#000000', | |
}, | |
background: { | |
default: '#353030', | |
}, | |
text: { | |
primary: '#f7f2f2', | |
}, | |
} | |
}) | |
const LIGHT_THEME = createTheme({ | |
...baseTheme, | |
palette: { | |
type: "light", | |
primary: { | |
main: '#decb4a', | |
}, | |
secondary: { | |
main: "#26a27b" | |
}, | |
background: { | |
default: '#f9f6f6', | |
}, | |
text: { | |
primary: '#141414', | |
}, | |
} | |
}) | |
export { DARK_THEME, LIGHT_THEME, LOCAL_STORAGE_KEY } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment