I am doing a simple webpage with React and I defined the following palette using in a theme using createMuiTheme from material-ui.
palette: {
primary: {
main: "#333333"
},
secondary: {
main: "#727171"
},
background: {
paper: "#f8f3f0",
default: "#f8f3f0"
},
accent: {
main: "#80d6d1"
}
}
Then, when I want to use my accent color for some text I use:
const useStyles = makeStyles(theme => ({
content: {
backgroundColor: theme.palette.background.default,
minHeight: "90vh"
color: theme.palette.background.main
}
}));
I get the following error:
TypeError: Cannot read property 'main' of undefined
71 | minHeight: "90vh"
> 72 | color: theme.palette.accent.main
73 | }
74 | }));
Any ideas of what's wrong here?
console.log(theme.palette)
and make sure that anaccent
property exists. – larz