Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xclw2000 opened this issue Jun 4, 2024 · 5 comments
Open

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

xclw2000 opened this issue Jun 4, 2024 · 5 comments

Comments

@xclw2000
Copy link

xclw2000 commented Jun 4, 2024

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

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

@chenshuai2144
Copy link
Contributor

用的是card的配置 没专门搞了个procard

@xclw2000
Copy link
Author

xclw2000 commented Jun 4, 2024

我设置了Card,但仍然不生效

  antd: {
    configProvider: {
      theme: {
        components: {
          Card: {
            colorText: 'red',
          },
          ProCard: {
            colorText: 'red',
          },
        },
      },
    },
  },

生成的style里仍然是黑色

.ant-pro-card .ant-pro-card-title {
    color: rgba(0, 0, 0, 0.88);
    font-weight: 500;
    font-size: 16px;
    line-height: 1.5714285714285714;
}

image

通过查看Card的源码,发现在影响Card的token是colorTextHeading,于是做以下修改

  antd: {
    configProvider: {
      theme: {
        components: {
          Card: {
            colorTextHeading: 'green',            
          },
          ProCard: {
            colorTextHeading: 'blue'            
          },
        },
      },
    },
  },

发现只能对Card生效,对ProCard不生效
image

@amusiq
Copy link

amusiq commented Jun 5, 2024

same here

@uniquejava
Copy link

借个楼, collapse-button 的颜色哪里改, 我想调成主题色 (蓝 -> 深绿), 和左边的 primary button 不太协调

image

@uniquejava
Copy link

啊. 我发现边边角角的很多地方的颜色都是蓝色, 都不是根据 PrimaryColor 计算出来的

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants