使用以下主题(使用 styleOverrides
)和用法,我如何更改引用调色板和颜色变体的悬停样式?
<Button color="secondary">
I expect this button's hover color to be red, and the variant to be contained
</Button>
const theme: Theme = createTheme({
palette: {
mode: "light",
primary: {
main: "green"
},
secondary: {
main: "red"
}
},
components: {
MuiButton: {
defaultProps: {
variant: "contained"
},
styleOverrides: {
root: {
"&:hover": {
backgroundColor: palette.main
}
}
}
}
}
})