ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.13k stars 8.12k forks source link

🧐[问题 | question]如何修改pro-component的样式 #11249

Open xclw2000 opened 1 month ago

xclw2000 commented 1 month ago

🧐 问题描述 | 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',
            },
          },
        },
      },
    },
  },

仍然不生效,请问这里的配置应该怎么写?

Fettes commented 1 month ago

路过。pro官方提供的是:

image image

但是我觉得这样也能改: 局部修改:https://v1.pro.ant.design/docs/style 全局theme:https://v1.pro.ant.design/docs/theme