ice icon indicating copy to clipboard operation
ice copied to clipboard

ice3.x工程中使用antd5.x版本应该如何更改主题色

Open yymelo opened this issue 2 years ago • 3 comments

Describe the bug

const minify = process.env.NODE_ENV === 'production' ? 'swc' : false export default defineConfig(() => ({ ssg: false, minify, plugins: [ request(), store(), auth(), antd({ theme: { // primary-color 为 antd 的 theme token // 'colorPrimary': '#8F5BF8', 'primary-color': '#8F5BF8', 'text-color': '#333333', 'text-color-secondary': '#666666', }, }), ], compileDependencies: false, })) 这样在之前antd是4.x的版本时是能够改掉主题色的,生了antd的版本之后这样不起作用了

Expected behavior

能够换掉antd的主题色

Actual behavior

No response

Version of ice.js

3.3.0

Content of build.json or ice.config.mts

No response

Additional context

No response

yymelo avatar Jan 02 '24 14:01 yymelo

import { defineConfig } from '@ice/app'; import antd from '@ice/plugin-antd';

export default defineConfig(() => ({ plugins: [ antd({ theme: { // primary-color 为 antd 的 theme token 'primary-color': '#1DA57A', }, }), ], })); 按照ice3文档教程中的操作步骤,这样的更改对antd5.x不起作用

yymelo avatar Jan 02 '24 15:01 yymelo

对于 antd 5 已经不用使用那个 plugin-antd 的插件了 在 layout.tsx 中用 antd 的 ConfigProvider 包裹一下 <Outlet /> 在里面直接修改 token

return (
<ConfigProvider
      locale={antdLocale[locale]}
      theme={{
        token: {
          fontFamily:
            "'Open Sans', 'Arial', 'Helvetica', 'Microsoft YaHei', 'WenQuanYi Micro Hei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', sans-serif",
        },
        components: {
          Table: {
            rowHoverBg: '#FFE8F7',
          },
        },
      }}
    >
    <Outlet />
</ConfigProvider>
);

aspirantzhang avatar Jan 03 '24 03:01 aspirantzhang

antd 5 已经不是 less 的样式方案,而是 css in js 的方式,后续我们考虑下怎么在插件中集成

ClarkXia avatar Jan 04 '24 06:01 ClarkXia