【发布时间】:2019-12-13 05:05:05
【问题描述】:
当我通过将theme.palette.type 的值更改为'dark' 来切换主题时,所有白色组件都将其颜色更改为深色,但对于像AppBar 这样具有#3f51b5 作为默认原色的组件而言,情况并非如此。
我认为通过将 theme.palette.type 设置为 'dark' 会将其颜色更改为深色变体 theme.palette.primary.dark (#303f9f) 或者可能是真正的深色 (#212121),但事实并非如此。如何将深色主题也应用到此组件?
const theme = createMuiTheme({
palette: {
type: 'dark',
primary: {
light: "#7986cb",
main: "#3f51b5",
dark: "#303f9f",
contrastText: "#fff",
},
});
const App = () => {
return (
<MuiThemeProvider theme={theme}>
<AppBar />
</MuiThemeProvider>
);
}
【问题讨论】:
-
你能分享一些你的代码,让我们看看你做了什么吗?
-
不知道的问题,谢谢
标签: javascript reactjs themes material-ui