63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
/**
|
|||
|
|
* Ant Design 5.x 主题配置
|
||
|
|
* 使用 ConfigProvider 配置主题 token
|
||
|
|
*/
|
||
|
|
import React from 'react';
|
||
|
|
import { ConfigProvider, theme as antdTheme } from 'antd';
|
||
|
|
import zhCN from 'antd/es/locale/zh_CN';
|
||
|
|
|
||
|
|
// 深色科技主题配置
|
||
|
|
const customTheme = {
|
||
|
|
// 使用暗色算法
|
||
|
|
algorithm: antdTheme.darkAlgorithm,
|
||
|
|
token: {
|
||
|
|
// 主色
|
||
|
|
colorPrimary: '#00d4ff',
|
||
|
|
// 链接色
|
||
|
|
colorLink: '#00d4ff',
|
||
|
|
// 成功色
|
||
|
|
colorSuccess: '#00ff88',
|
||
|
|
// 警告色
|
||
|
|
colorWarning: '#ffa502',
|
||
|
|
// 错误色
|
||
|
|
colorError: '#ff4757',
|
||
|
|
// 圆角
|
||
|
|
borderRadius: 8,
|
||
|
|
// 字体
|
||
|
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
||
|
|
},
|
||
|
|
components: {
|
||
|
|
Button: {
|
||
|
|
colorPrimary: '#00d4ff',
|
||
|
|
algorithm: true,
|
||
|
|
},
|
||
|
|
Input: {
|
||
|
|
colorBgContainer: 'rgba(255, 255, 255, 0.05)',
|
||
|
|
colorBorder: 'rgba(0, 212, 255, 0.3)',
|
||
|
|
},
|
||
|
|
Select: {
|
||
|
|
colorBgContainer: 'rgba(255, 255, 255, 0.05)',
|
||
|
|
colorBorder: 'rgba(0, 212, 255, 0.3)',
|
||
|
|
},
|
||
|
|
Table: {
|
||
|
|
colorBgContainer: 'transparent',
|
||
|
|
headerBg: 'rgba(0, 212, 255, 0.1)',
|
||
|
|
},
|
||
|
|
Modal: {
|
||
|
|
contentBg: 'rgba(15, 25, 40, 0.95)',
|
||
|
|
headerBg: 'rgba(15, 25, 40, 0.95)',
|
||
|
|
},
|
||
|
|
Card: {
|
||
|
|
colorBgContainer: 'rgba(15, 25, 40, 0.85)',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||
|
|
return (
|
||
|
|
<ConfigProvider theme={customTheme} locale={zhCN}>
|
||
|
|
{children}
|
||
|
|
</ConfigProvider>
|
||
|
|
);
|
||
|
|
};
|