简体   繁体   中英

How does Material-UI theme light / dark work?

I don't know how the light / dark in the theme works. I can observe how the main works. When I change the color of the main, the components change, but changing the light / dark value in type does nothing.

const theme = createMuiTheme({
  palette: {
  type: 'dark',
  primary: {
      light: '#ddd',
      main: '#f00',
      dark: '#666',
      contrastText: '#ddd'
    }
  }
});

<ThemeProvider theme={theme}>
  <CssBaseline>
    <Typography variant='h1' component='h1' color='primary'>
      Hello
    </Typography>
  </CssBaseline>
</ThemeProvider>;
<Box bgcolor='primary.light' color='primary.contrastText'>
 Lorem ipsum dolor sit amet.
</Box>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM