新版界面:品牌主题(深绿、暖纸色、金色强调)与应用外壳(顶栏、左侧导航、手机抽屉)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4a00b8f3fc
commit
eeea870963
10 files changed
+1340
-357
No files matched your search
@@ -0,0 +1,77 @@
|
||||
// 品牌主题:沿用旧界面(public/app.css)的深绿、暖纸色与金色强调。所有颜色只在这里定义,
|
||||
// antd 组件通过 ConfigProvider 的 token 取用;styles.css 里的少量自定义样式通过 CSS 变量取用(见 cssVars)。
|
||||
import type { ThemeConfig } from 'antd';
|
||||
|
||||
export const brand = {
|
||||
ink: '#233d35',
|
||||
muted: '#5f6a64', // 旧界面 #68736d 在暖纸底上略低于 4.5:1,这里加深一点以满足 WCAG AA。
|
||||
paper: '#f6f5f0',
|
||||
border: '#dedfd6',
|
||||
borderStrong: '#c9cbbf',
|
||||
gold: '#a97b35',
|
||||
goldText: '#86601f', // 金色用作小号文字时的加深版(对白底 ≥ 4.5:1)。
|
||||
green: '#254e40',
|
||||
greenHover: '#336553',
|
||||
white: '#fffefa',
|
||||
danger: '#a03d31',
|
||||
soft: '#edf2ec',
|
||||
internalText: '#6e4b17',
|
||||
internalTextAlt: '#805617',
|
||||
internalBg: '#fffaf0',
|
||||
internalBgAlt: '#faf7ef',
|
||||
internalBorder: '#d2bf98',
|
||||
internalBorderAlt: '#d9cbae',
|
||||
};
|
||||
|
||||
export const fontFamily = "-apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif";
|
||||
|
||||
export const theme: ThemeConfig = {
|
||||
token: {
|
||||
colorPrimary: brand.green,
|
||||
colorInfo: brand.green,
|
||||
colorSuccess: '#2f6b4f',
|
||||
colorWarning: brand.gold,
|
||||
colorError: brand.danger,
|
||||
colorLink: brand.green,
|
||||
colorLinkHover: brand.greenHover,
|
||||
colorText: brand.ink,
|
||||
colorTextHeading: brand.ink,
|
||||
colorTextSecondary: brand.muted,
|
||||
colorTextDescription: brand.muted,
|
||||
colorBorder: brand.borderStrong,
|
||||
colorBorderSecondary: brand.border,
|
||||
colorBgLayout: brand.paper,
|
||||
colorBgContainer: brand.white,
|
||||
colorBgElevated: '#ffffff',
|
||||
colorFillAlter: brand.internalBgAlt,
|
||||
colorBgContainerDisabled: '#f1f0ea',
|
||||
fontFamily,
|
||||
fontSize: 14,
|
||||
borderRadius: 8,
|
||||
borderRadiusLG: 12,
|
||||
borderRadiusSM: 6,
|
||||
controlHeight: 38,
|
||||
controlHeightLG: 46,
|
||||
controlHeightSM: 28,
|
||||
lineWidthFocus: 2,
|
||||
controlOutline: 'rgba(37, 78, 64, 0.16)',
|
||||
boxShadowTertiary: '0 1px 2px rgba(35, 61, 53, 0.04), 0 2px 8px rgba(35, 61, 53, 0.04)',
|
||||
},
|
||||
components: {
|
||||
Button: { primaryShadow: 'none', defaultShadow: 'none', fontWeight: 500 },
|
||||
Card: { headerFontSize: 16, headerHeight: 56, paddingLG: 24 },
|
||||
Radio: { buttonSolidCheckedBg: brand.green, buttonSolidCheckedHoverBg: brand.greenHover, buttonPaddingInline: 12 },
|
||||
Collapse: { headerBg: brand.white, contentBg: brand.white },
|
||||
Tag: { defaultBg: brand.soft, defaultColor: brand.ink },
|
||||
Tooltip: { colorBgSpotlight: brand.ink },
|
||||
Result: { titleFontSize: 22 },
|
||||
Drawer: { colorBgElevated: brand.white },
|
||||
},
|
||||
};
|
||||
|
||||
// 供 styles.css 使用的 CSS 变量:--ink、--gold、--internal-bg 等,通过 CSSOM 写到根节点(不受 CSP 限制)。
|
||||
export function applyCssVars(root: HTMLElement = document.documentElement) {
|
||||
for (const [key, value] of Object.entries(brand))
|
||||
root.style.setProperty('--' + key.replace(/[A-Z]/g, c => '-' + c.toLowerCase()), value);
|
||||
root.style.setProperty('--font', fontFamily);
|
||||
}
|
||||
Reference in new issue
Block a user