我使用的是 mui 版本 5.11.13。我已经配置了我的 theme.tsx 如下。 还尝试了增强模块。
import { experimental_extendTheme as extendTheme } from "@mui/material/styles";
declare module "@mui/material/styles" {
interface ColorSchemeOverrides {
customTheme1: true;
customTheme2: true;
}
}
const Theme = extendTheme({
colorSchemes: {
light: {
palette: {
primary: {
main: "#313E48",
}
}
},
dark: {
palette: {
primary: {
main: "#FFFFFF",
}
}
},
customTheme1:{
palette: {
primary: {
main: "#000000",
}
}
}
customTheme2:{
palette: {
primary: {
main: "#BBBBBB",
}
}
}
},
});
对此有任何帮助。预先感谢。
您可以尝试添加其他颜色选项
{
light?: string;
main: string;
dark?: string;
contrastText?: string;
}