ant-design / ant-design/pro-components

🧐[问题]如何修改pro-component的样式

Open
#8,467 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🧐 问题描述 | Problem description
使用 pro-cli 建的项目
我想修改所有的ProCard的标题颜色
通过查看源码
```
[`${componentCls}-title`]: {
color: token.colorText,
fontWeight: 500,
fontSize: token.fontSizeLG,
lineHeight: token.lineHeight,
}
```
得知文本颜色是从token.colorText取的, 于是在config.ts中作如下配置
```
antd: {
configProvider: {
theme: {
cssVar: true,
components: {
ProCard: {
colorText: 'red',
},
},
},
},
}
```
发现这种方式无法修改文字的颜色
接着尝试如下配置,加一层token
```
antd: {
configProvider: {
theme: {
cssVar: true,
components: {
ProCard: {
token: {
colorText: 'red',
},
},
},
},
},
},
```
仍然不生效,请问这里的配置应该怎么写?

Contributor guide

Open the contributing guide

Research direction

Start with the config.ts theme configuration and the ProCard title styling shown in the issue. Reproduce the setup in a project created with pro-cli, then verify which configuration is read by the ProCard component. Done means the configured title color is visibly applied to all ProCard titles.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.