我正在为react-admin
应用设计样式。
在theming指南的帮助下,我有一个自定义的MUI theme
。
如何为<ReferenceField>
应用不同的颜色?
我看到here的定义是:
const useStyles = makeStyles(theme => ({
link: {
color: theme.palette.primary.main,
},
}),
{ name: 'RaReferenceField' }
);
除了主调色板之外,我想用我自己的颜色覆盖它。
我可以为MuiChip
和其他类似组件使用它:
const myTheme = createMuiTheme({
palette: {
primary: {
main: "rgba(197, 218, 0, 1)",
contrastText: "rgba(45, 0, 40, 1)"
},
secondary: {
main: "rgba(45, 0, 40, 1)",
contrastText: "rgba(197, 218, 0, 1)",
},
},
overrides: {
MuiChip: {
root: {
backgroundColor: "rgba(45, 0, 40, 0.14)",
color: "rgba(45, 0, 40, 1)",
},
},
},
});
const App = () => (
<Admin theme={myTheme} dataProvider={dataProvider}>
// ...
我希望我的<ReferenceField>
文字颜色为红色,但这在上面的overrides
部分中无效:
ReferenceField : {
root: {
color: 'red'
}
}
有什么想法可以与theming
一起使用,而无需制作自己的<ReferenceField>
组件吗?