material ui set primary color code example

Example 1: material ui color background

// import Box from Material-UI
import Box from '@material-ui/core/Box';

// Use bgcolor to set background color in box
<Box bgcolor="primary.main" />
<Box bgcolor="secondary.main" />
<Box bgcolor="error.main" />
<Box bgcolor="warning.main" />
<Box bgcolor="info.main" />
<Box bgcolor="success.main" />
<Box bgcolor="text.primary" />
<Box bgcolor="text.secondary" />
<Box bgcolor="text.disabled" />

Example 2: themein material ui

import { createMuiTheme } from '@material-ui/core/styles';
import purple from '@material-ui/core/colors/purple';
import green from '@material-ui/core/colors/green';

const theme = createMuiTheme({
  palette: {
    primary: purple,
    secondary: green,
  },
  status: {
    danger: 'orange',
  },
});