对于高对比度主题,我想为Paper
元素(例如ExpansionPanel
/ Card
)提供浅色背景色,并将palette.background.default
设置为深色
但是,对比的文本始终遵循背景。默认设置,因此在纸张上几乎看不见。
您可以使用createMuiTheme
为background.default和background.paper设置不同的对比度文本颜色吗?
这显然行不通,但这是我要的目的:
const themeObj = {}
palette = {...initialPalette};
palette.background.defaultType = lightOrDark(palette.background.default);
palette.background.defaultContrastText = palette.background.defaultType === 'light' ? '#000' : '#FFF';
palette.background.paperType = lightOrDark(palette.background.paper);
palette.background.paperContrastText = palette.background.paperType === 'light' ? '#000' : '#FFF';
themeObj.palette = palette;
const theme = createMuiTheme(themeObj);