【发布时间】:2017-01-01 11:29:06
【问题描述】:
我正在尝试为AppBar 标头使用我的自定义颜色。 AppBar 的标题为“我的 AppBar”。我使用白色作为我的主要主题颜色。它适用于酒吧,但 AppBar 的“标题”也使用相同的“白色”颜色”
这是我的代码:
import React from 'react';
import * as Colors from 'material-ui/styles/colors';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import AppBar from 'material-ui/AppBar';
import TextField from 'material-ui/TextField';
const muiTheme = getMuiTheme({
palette: {
textColor: Colors.darkBlack,
primary1Color: Colors.white,
primary2Color: Colors.indigo700,
accent1Color: Colors.redA200,
pickerHeaderColor: Colors.darkBlack,
},
appBar: {
height: 60,
},
});
class Main extends React.Component {
render() {
// MuiThemeProvider takes the theme as a property and passed it down the hierarchy
// using React's context feature.
return (
<MuiThemeProvider muiTheme={muiTheme}>
<AppBar title="My AppBar">
<div>
< TextField hintText = "username" / >
< TextField hintText = "password" / >
</div>
</AppBar>
</MuiThemeProvider>
);
}
}
export default Main;
但是,调色板样式会覆盖 AppBar 'title' 颜色并且没有标题显示。我应该包括一些东西还是我放错了任何东西?
【问题讨论】:
标签: reactjs material-ui