fix(theme): 浅色主题标签强调色改为按 WCAG 加深(实测 4.0:1 -> 4.9:1)

浅色分支此前固定 mix(accent, #000, 0.35),默认绿 #3fb950 得 #297834:在强调色
染过的激活标签底(≈#dae8df)上只有 4.0:1,低于 AA,用户自定义的浅色强调色还会
更差。改用 darkenToRatio(accent, chromeBg, 5.5)——对 chrome 底色保证 5.5:1,
落到更深的染色底上仍有 4.9:1。深色分支(mix 白 0.18)不动。

chrome.ts 新增 chromeBg 记录当前 chrome 底色(applyTabAccent 可能在
applyChromeTheme 之前被设置变更单独调用);#181818 是 pre-JS 深色默认值,
登记进 css-theme-vars 白名单(与 global.css 的 --chrome-bg 同值)。
This commit is contained in:
Bill committed 2026-10-16 23:44:48 +08:00
1 parent 3b86d62111
commit 81748e4470
2 files changed
+15 -3

No files matched your search

+2 -1
View File
@@ -16,8 +16,9 @@ const WHITELIST = {
// The layer that DEFINES the anchors and derives per-theme values.
'theme/semantic.ts': null,
// Pre-existing --chrome-* derivation anchors (mix targets / overlay bases).
// #181818 = global.css --chrome-bg, the pre-JS chromeBg default.
'theme/chrome.ts': new Set([
'#000000', '#ffffff',
'#000000', '#ffffff', '#181818',
'rgba(0, 0, 0, 0.045)', 'rgba(0, 0, 0, 0.09)', 'rgba(0, 0, 0, 0.18)', 'rgba(0, 0, 0, 0.32)',
'rgba(255, 255, 255, 0.04)', 'rgba(255, 255, 255, 0.07)', 'rgba(255, 255, 255, 0.1)', 'rgba(255, 255, 255, 0.2)'
]),