如何在material-ui中使用浅二次色

MMJ*_*MMJ 5 reactjs material-design material-ui

我有这个主题

 palette: {
primary: {
  main: '#d05ce3',
},
secondary: {
  light: '#0066ff',
  main: '#0044ff',

},
Run Code Online (Sandbox Code Playgroud)

我可以使用像这样找到的辅助颜色

<ThemeProvider theme={theme}>
              <Checkbox
                color="secondary" 
Run Code Online (Sandbox Code Playgroud)

但是如何使用光二次呢?在ThemeProvider

喜欢color="secondary.light"不行!

小智 2

您必须为您的复选框声明一个类,并在您的 css 中表明您使用您想要的颜色。例子:

<ThemeProvider theme = {theme}>
          <Checkbox
            color = "secondary"
            className = {classes.checkboxColor}
             />
Run Code Online (Sandbox Code Playgroud)

CSS 文件:

checkboxColor: {
    color: theme.palette.secondary.light
  }
Run Code Online (Sandbox Code Playgroud)