Home > Back-end >  I can't change the global background material ui
I can't change the global background material ui

Time:07-24

the material ui libraries have a white global background by default at startup, I tried to change it to red, but it doesn't work. How can it be changed? the default is a white background, I want to make a different color

   MuiDivider: {
              styleOverrides: {
                  root: {
                   backgroundColor:"#cc5a5a",
                    },
                  },
                },

CodePudding user response:

I think you should import 'makeStyles' to be able to change the background. You can try this one:

import { makeStyles } from "@material-ui/core/styles";

const useStyles = makeStyles((theme) => ({
 root: {
  borderColor: "#cc5a5a",
  backgroundColor:"#cc5a5a",
 }
}));

export default function Sample() {
 const classes = useStyles();

 return (
  <div className={classes.root}>...</div>
 )
}

Also do try to do some research in the future before posting a question here.

  • Related