51 lines
1.8 KiB
CSS
51 lines
1.8 KiB
CSS
/**
|
||
* accents.css — 5 套强调色覆盖
|
||
* 通过 <html data-accent="..."> 切换
|
||
*/
|
||
|
||
/* 默认(兜底)—— Linear Purple */
|
||
:root,
|
||
:root[data-accent="purple"] {
|
||
--accent: #5E6AD2;
|
||
--accent-soft: rgba(94, 106, 210, 0.12);
|
||
--accent-hover: rgba(94, 106, 210, 0.20);
|
||
}
|
||
|
||
:root[data-accent="blue"] {
|
||
--accent: #3B82F6;
|
||
--accent-soft: rgba(59, 130, 246, 0.12);
|
||
--accent-hover: rgba(59, 130, 246, 0.20);
|
||
}
|
||
|
||
:root[data-accent="green"] {
|
||
--accent: #10B981;
|
||
--accent-soft: rgba(16, 185, 129, 0.12);
|
||
--accent-hover: rgba(16, 185, 129, 0.20);
|
||
/* 亮绿底 + 白字只有 2.5:1(WCAG 需 4.5),slot 序号等 accent 底色文字改深色 → 5.8:1 */
|
||
--accent-text: #1F2937;
|
||
}
|
||
|
||
:root[data-accent="orange"] {
|
||
--accent: #F59E0B;
|
||
--accent-soft: rgba(245, 158, 11, 0.12);
|
||
--accent-hover: rgba(245, 158, 11, 0.20);
|
||
/* 同 green:亮橙底 + 白字 2.2:1 → 深色 6.8:1 */
|
||
--accent-text: #1F2937;
|
||
}
|
||
|
||
:root[data-accent="red"] {
|
||
--accent: #EF4444;
|
||
--accent-soft: rgba(239, 68, 68, 0.12);
|
||
--accent-hover: rgba(239, 68, 68, 0.20);
|
||
}
|
||
|
||
/* Light 主题下 accent 直接作文字色对比度不足(实测 orange 2.06 / green 2.43 /
|
||
* blue 3.52,WCAG 正文需 ≥4.5)—— 文字场景(--accent-fg)改用同色系深色变体,
|
||
* 全部 ≥4.6:1;色块填充 / 边框仍用 --accent 本身,品牌色观感不变。
|
||
* 深色主题各 accent 文字对比度 ≥3.2 且多为图标/强调短文本,维持原色。 */
|
||
:root[data-theme="light"][data-accent="purple"] { --accent-fg: #4F46E5; }
|
||
:root[data-theme="light"][data-accent="blue"] { --accent-fg: #2563EB; }
|
||
:root[data-theme="light"][data-accent="green"] { --accent-fg: #047857; }
|
||
:root[data-theme="light"][data-accent="orange"] { --accent-fg: #B45309; }
|
||
:root[data-theme="light"][data-accent="red"] { --accent-fg: #DC2626; }
|