Created
March 11, 2020 10:18
-
-
Save tr00st/da2abc576fe38ed3eed266340465830e to your computer and use it in GitHub Desktop.
Horrendous Material-UI theme generator
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 { createMuiTheme } from "@material-ui/core"; | |
/* | |
Generates a random theme for Material-UI. Usually horrible. | |
*/ | |
const randomColor = () => { | |
return ["#",Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16)].join(""); | |
} | |
const theme = createMuiTheme({ | |
palette: { | |
type: Math.random() > 0.5 ? 'dark' : "light", | |
primary: { | |
main: randomColor() | |
}, | |
secondary: { | |
main: randomColor() | |
}, | |
background: { | |
default: randomColor(), | |
paper: randomColor() | |
} | |
} | |
}); | |
// Log the palette in case it's horrendous enough that you want to keep it | |
console.log(theme.palette); | |
export default theme; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment