无法更改应用栏背景颜色

时间:2021-03-04 08:36:35

标签: reactjs material-ui appbar

我使用 https://codesandbox.io/s/github/SabuShakya/React-Sidebar-Using-Material-UI/ 一个作为参考, 我想将 appbar 的背景更新为 #ffb74d,

我检查了很多答案,答案在我尝试过的其他项目中对我有用,但同样的方法在这个项目中无济于事,我不知道这里出了什么问题

以下代码是我在 MiniDrawer.js 中添加的,没有按预期运行

    const theme = createMuiTheme({
      palette: {
        primary: {
          // Purple and green play nicely together.
          main: '#0fb7ae',
        },
        secondary: {
          // This is green.A700 as hex.
          main: '#11cb5f',
        },
      },
    });


....
            <ThemeProvider theme={theme}>
            <AppBar
                position="fixed"
                color={theme.palette.primary.main}
.......

有人帮我吗?

1 个答案:

答案 0 :(得分:2)

你可以试试这个 Appbar 背景色

enter image description here

相关问题