我在直接更改Material UI主题中按钮文本颜色方面遇到了问题。更改主要颜色和按钮字体大小可以正常工作,因此问题不在于传递主题。以下是我的代码:
import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import { lightBlue } from 'material-ui/colors';
import styled from 'styled-components';
const theme = createMuiTheme({
palette: {
primary: lightBlue, // works
},
raisedButton: {
color: '#ffffff', // doesn't work
},
typography: {
button: {
fontSize: 20, // works
color: '#ffffff' // doesn't work
}
}
});
const App = ({ user, pathname, onToggleDrawer }) => (
<MuiThemeProvider theme={theme}>
...
</MuiThemeProvider>
);
我也尝试使用导入的颜色代替#ffffff
,但是那也没有任何效果。
有人有什么想法吗?
white
颜色。 我们支持以下格式:#nnn,#nnnnnn,rgb(),rgba(),hsl(),hsla()。" 因此将其更改为 #fff。 - VaibS