Browse Source

feat: 修改主题

pull/19/head^2
cp3hnu 1 year ago
parent
commit
7997a2f98b
2 changed files with 29 additions and 0 deletions
  1. +23
    -0
      react-ui/src/app.tsx
  2. +6
    -0
      react-ui/src/styles/theme.less

+ 23
- 0
react-ui/src/app.tsx View File

@@ -1,7 +1,9 @@
import RightContent from '@/components/RightContent';
import themes from '@/styles/theme.less';
import type { Settings as LayoutSettings } from '@ant-design/pro-components';
import type { RunTimeLayoutConfig } from '@umijs/max';
import { history } from '@umijs/max';
import { RuntimeAntdConfig } from 'umi';
import defaultSettings from '../config/defaultSettings';
import '../public/fonts/font.css';
import { getAccessToken } from './access';
@@ -182,3 +184,24 @@ export function render(oldRender: () => void) {
oldRender();
});
}

// 主题修改
export const antd: RuntimeAntdConfig = (memo) => {
memo.theme ??= {};
memo.theme.token = {
colorPrimary: themes['primaryColor'],
};
memo.theme.components ??= {};
memo.theme.components.Tabs = {};
// memo.theme.cssVar = true;
// memo.theme.hashed = false;

// memo.appConfig = {
// message: {
// // 配置 message 最大显示数,超过限制时,最早的消息会被自动关闭
// maxCount: 3,
// },
// };

return memo;
};

+ 6
- 0
react-ui/src/styles/theme.less View File

@@ -1,6 +1,12 @@
// 全局颜色变量
// FIXME: 不能设置 @primary-color 不起作用,感觉是哪里被重置了
@kf-primary-color: #1664ff; // 主色调
@text-color: #1d1d20;
@font-size: 15px;
@border-color: rgba(22, 100, 255, 0.3);
@border-color-second: rgba(22, 100, 255, 0.1);
@background-color-primay: rgba(22, 100, 255, 0.03);
@background-color-gray: rgba(4, 3, 3, 0.06);

// 导出变量
:export {


Loading…
Cancel
Save