gpt4 book ai didi

javascript - 如何应用所选主题的颜色

转载 作者:行者123 更新时间:2023-12-03 02:07:06 26 4
gpt4 key购买 nike

我正在使用https://material-ui-next.com/如下:

import React, { Component } from 'react';
import { AppBar, Toolbar } from 'material-ui';
import { Typography } from 'material-ui';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import {cyan, blue} from 'material-ui/colors';

const theme = createMuiTheme({
palette: {
primary:{
main:blue[900]
},
secondary: cyan,
},
});

class App extends Component {
render() {
return (
<MuiThemeProvider theme={theme}>
<AppBar position="static">
<Toolbar>
<Typography variant="title">
Hello
</Typography>
</Toolbar>
</AppBar>
</MuiThemeProvider>
);
}
}

export default App;

如您所见,我将主要主题更改为

main:blue[900]

但是字体颜色是黑色。如何将字体颜色改为白色?
正在查看https://material-ui-next.com/style/color/ ,字体颜色为白色。

输出为: enter image description here

字体颜色是黑色,但我想改为白色。

最佳答案

尝试将您的主题对象更改为:

const theme = createMuiTheme({
palette: {
primary: {
main: blue[900]
},
text: {
primary: '#fff',
}
}
});

引用:https://material-ui-next.com/customization/themes/

关于javascript - 如何应用所选主题的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49755713/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com