反应材质UI模式更改文本颜色更改

时间:2019-06-24 21:03:04

标签: reactjs material-ui

我的页面上有此按钮,可将页面上的主题从暗变亮。 enter image description here

文本变为白色,背景变为黑色,然后再次单击,反之亦然。我没有为任何元素专门指定颜色道具或背景道具,但一切正常。问题出在下面的按钮上

enter image description here

如您所见,它们是红色的并且来自primary.light,尽管当激活黑暗主题时,它必须是primary.dark,但不是...

  const theme = createMuiTheme({
    palette: {
      type: mode,
      primary: {
        light: "#FF0000",
        main: "#3f50b5",
        dark: "#002884",
        contrastText: "#FF0000"
      },
      secondary: {
        light: "#ff7961",
        main: "#f44336",
        dark: "#ba000d",
        contrastText: "#000"
      }
    },
    typography: {
      useNextVariants: true
    }
  });

0 个答案:

没有答案
相关问题