task-242(admin.html观感对齐): Element Plus 语义色/圆角对齐蓝白浅色(ep-overrides 单源)

This commit is contained in:
2026-09-05 20:48:57 +08:00
parent c924ffa16d
commit 50ba594ad1
3 changed files with 117 additions and 1 deletions
@@ -0,0 +1,35 @@
/**
* Element Plus 主题对齐映射(module 13 task 242):把 Element 默认语义色/圆角
* 对齐 admin.html 蓝白浅色皮肤。main.css 用 elCssVars() 的结果承载 --el-* 变量;
* tests 用本模块校验值正确且已落盘,防止 Element 默认红绿黄(#f56c6c/#67c23a/#e6a23c)回潮。
*/
export const EP_ALIGN = {
primary: '#4f78a5',
success: '#4e806d',
warning: '#a8793e',
danger: '#b35f6a',
borderColor: '#d8e3ee',
borderRadiusBase: '9px',
} as const
export type EpAlignKey = keyof typeof EP_ALIGN
export function elCssVarName(key: EpAlignKey): string {
if (key === 'borderColor') return '--el-border-color'
if (key === 'borderRadiusBase') return '--el-border-radius-base'
return `--el-color-${key}`
}
/** 需要落盘到 main.css 的 --el-* 变量(key -> CSS 值)。 */
export function elCssVars(): Record<string, string> {
const out: Record<string, string> = {}
for (const key of Object.keys(EP_ALIGN) as EpAlignKey[]) {
out[elCssVarName(key)] = EP_ALIGN[key]
}
// danger/success/warning 的 light 家族 Element 不会自动从 base 推导覆盖,
// 显式对齐成浅色调(供标签/提示等底色使用),避免仍偏默认色。
out['--el-color-success-light-9'] = '#eef5f0'
out['--el-color-warning-light-9'] = '#fbf4ea'
out['--el-color-danger-light-9'] = '#faf0f1'
return out
}
+10 -1
View File
@@ -16,7 +16,16 @@
--el-color-primary-light-8: #e1e9f0;
--el-color-primary-light-9: #f0f4f8;
--el-color-primary-dark-2: #3f628a;
--el-border-radius-base: 6px;
/* 语义色/边框/圆角对齐 admin.html 蓝白浅色皮肤(EP_ALIGN 单源,勿单独改) */
--el-color-success: #4e806d;
--el-color-warning: #a8793e;
--el-color-danger: #b35f6a;
--el-color-success-light-9: #eef5f0;
--el-color-warning-light-9: #fbf4ea;
--el-color-danger-light-9: #faf0f1;
--el-border-color: #d8e3ee;
--el-border-color-base: #d8e3ee;
--el-border-radius-base: 9px;
}
* { box-sizing: border-box; }