pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

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

Open xclw2000 opened this issue 1 year ago • 5 comments

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

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

xclw2000 avatar Jun 04 '24 00:06 xclw2000

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

chenshuai2144 avatar Jun 04 '24 15:06 chenshuai2144

我设置了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

xclw2000 avatar Jun 04 '24 22:06 xclw2000

same here

amusiq avatar Jun 05 '24 08:06 amusiq

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

image

uniquejava avatar Jun 11 '24 16:06 uniquejava

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

image

uniquejava avatar Jun 11 '24 16:06 uniquejava

生效

确实是发现了一样的问题

enhezzz avatar Oct 30 '24 08:10 enhezzz