Search code examples
reactjsmaterial-uiappbar

Failed to change the appbar backgroud color


I use https://codesandbox.io/s/github/SabuShakya/React-Sidebar-Using-Material-UI/ one as reference, i want to update the background of appbar to #ffb74d,

I have checked lots of answers, the answer works for me in other project I tried,but the same method can't help in this one, I don't know what's wrong here

The following code is what I added in MiniDrawer.js, it doesn't work as expected

    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}
.......

Anyone help me out ?


Solution

  • You can try this for Appbar background color

    enter image description here