dsh-theme-palette 1.13.3 → 1.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,24 @@
8
8
  > 1.13.2 起逐节标注 —— 此前 27 个版本节看起来都能装,用户按 CHANGELOG 钉版本会撞 404
9
9
  > (2026-10-29 审计 P2-9)。
10
10
 
11
+ ### 1.13.4
12
+ 用户第二次回执:同一张悬停卡「还是深灰底色」。这次**明暗两套截图对比**把 1.13.3 的方向证伪了 ——
13
+ 浅色模式下(画布 `#f8fcf6`)卡片仍是 `#2c2c2e` + 白字,颜色一个像素都没变:
14
+ 它根本不读调色板,所以改多少条 token 都碰不到。
15
+
16
+ 逐文件扫宿主 asar 后定位到根因:**`dsh-web-frontend` 把悬停卡底色写死在卡片元素上** ——
17
+ `._card_38jqx_9{--dsw-hovercard-bg:#2C2C2E;background:var(--dsw-hovercard-bg)}`。
18
+ 这是全站唯一的大写手写 hex:既不读色阶、也不读别名,与主题完全无关(连浅色模式也是深灰)。
19
+
20
+ - **修法**:`buildTokens` 新增专用 token `--dsh-tp-hovercard-bg`(明暗两档都取色阶 **850 的暗面**),
21
+ 并注入第三条样式 `dsh-theme-palette/host-patch.css`:
22
+ `*{--dsw-hovercard-bg:var(--dsh-tp-hovercard-bg,#2c2c2e)!important}`。
23
+ 宿主的声明在卡片元素**自身**,普通声明压不过它,必须 `!important`;只改这一个自定义属性,
24
+ 其它元素即使命中也没有副作用。卡片保持**暗底白字**(对比度不变),但从此带上配色色相。
25
+ 黑白档没有色阶可接,回落到宿主原色(行为不变)。
26
+ - **断言**:`check-audit` 第 28 组 —— 明暗同值 / = 850 暗面 / 补丁样式的形态 / 黑白档不产出。
27
+ - 复核:`npm run check` 8/8;两档报表 exit 0。
28
+
11
29
  ### 1.13.3
12
30
  用户实测反馈:**左侧会话行的悬停卡(会话标题 / 时间 / 状态)底色不跟随主题色** —— 卡片背景停在
13
31
  `#2c2c2e`、标题近白,而旁边的侧栏与画布都是染过色的。
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
- "generatedAt": "2026-10-29T11:29:25.163Z",
3
- "pluginVersion": "1.13.3",
2
+ "generatedAt": "2026-10-29T11:56:54.301Z",
3
+ "pluginVersion": "1.13.4",
4
4
  "chrome": "Chrome/156.0.8078.49",
5
5
  "width": 620,
6
6
  "scale": 1,
@@ -14,13 +14,13 @@
14
14
  "--adv",
15
15
  "0"
16
16
  ],
17
- "htmlSha256": "8952278cd4d7eb94840604c8ffddba4c51670dd565bf80ead6f8820a84eff661",
17
+ "htmlSha256": "54916add6cedff817044eaf0eee2297265f8ff5b2fb336d3e201dad504bf2b35",
18
18
  "cssWidth": 620,
19
19
  "cssHeight": 888,
20
20
  "width": 620,
21
21
  "height": 888,
22
- "bytes": 47480,
23
- "sha256": "2504df2500e798c458dcb3014882b880c96ca09a057702a2845fd0252a2b736b"
22
+ "bytes": 47498,
23
+ "sha256": "d5fc7fe7a3a5012fc0e3947038e6faf69e3df23b5897d346fc3381da655b0fa0"
24
24
  },
25
25
  {
26
26
  "file": "assets/screenshot-settings-dark.png",
@@ -31,13 +31,13 @@
31
31
  "--adv",
32
32
  "0"
33
33
  ],
34
- "htmlSha256": "c8c71e00b0e2518beea8f4b58e64c57b70e7903f69829a9652fb27f11e3ffd6d",
34
+ "htmlSha256": "0348f7373871e7d430cf07615cfcd481476bc62478c0a57ba7918e6611b6dd98",
35
35
  "cssWidth": 620,
36
36
  "cssHeight": 888,
37
37
  "width": 620,
38
38
  "height": 888,
39
- "bytes": 47789,
40
- "sha256": "4133eaf99848b36dd4df90b5604155878df9f5b47d09e6cdccdce1e8b9fb3ca5"
39
+ "bytes": 47810,
40
+ "sha256": "ba07e44099f33978f5f7d62563b96e999f240aed4971e0657a145aa5188a452b"
41
41
  },
42
42
  {
43
43
  "file": "assets/screenshot-settings-custom.png",
@@ -50,13 +50,13 @@
50
50
  "--out",
51
51
  "customadv"
52
52
  ],
53
- "htmlSha256": "199f061201c88c70c0228dc2d9066f83d333f7b7f3c20627a3fe947b81e36084",
53
+ "htmlSha256": "5929bc3227c1c53bd6264bb9f3be23557b481a77271e204e77676ac526edc530",
54
54
  "cssWidth": 620,
55
55
  "cssHeight": 1753,
56
56
  "width": 620,
57
57
  "height": 1753,
58
- "bytes": 116545,
59
- "sha256": "c2b6d3d6e0a11b2da64c16b9729b0aa12b8cd9ea47b9627cd2d95881008306ab"
58
+ "bytes": 116566,
59
+ "sha256": "b7853a193d0be58f3284c363f379cc66fa9f490b83a49fd5abd6780cc70fa728"
60
60
  },
61
61
  {
62
62
  "file": "assets/screenshot-settings-hc.png",
@@ -69,13 +69,13 @@
69
69
  "--out",
70
70
  "hcadv"
71
71
  ],
72
- "htmlSha256": "56ea7c65091e98ff5a25149cd39933b14035da47ebc986ec4afb423ef0f475f6",
72
+ "htmlSha256": "5b68173af9cf81d3586c1ed4a206475427a7f266174420da1df22f1f1d84277d",
73
73
  "cssWidth": 620,
74
74
  "cssHeight": 1463,
75
75
  "width": 620,
76
76
  "height": 1463,
77
- "bytes": 94765,
78
- "sha256": "db1ff1416e5d6b0a0202f5a435a64137f4bf13a35fce6d43ad53497358b279cb"
77
+ "bytes": 94792,
78
+ "sha256": "e021a907dd32378591b0e5198027bd4ba2d19da112ccf3e4bf6fbb1929796c0e"
79
79
  }
80
80
  ]
81
81
  }
package/client.js CHANGED
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
27
27
  const React = require('react')
28
28
  const h = React.createElement
29
29
 
30
- const PLUGIN_VERSION = '1.13.3'
30
+ const PLUGIN_VERSION = '1.13.4'
31
31
  const STORE_KEY = 'dsh-theme-palette.v1'
32
32
  const OVERRIDE_SOURCE = 'dsh-theme-palette'
33
33
 
@@ -1936,6 +1936,12 @@ window.__ModuleLoader__.load({
1936
1936
  const dark = pairs['--dsw-static-neutral-bluish-' + steps.dark]
1937
1937
  if (light && dark) pairs[name] = { light: light.light, dark: dark.dark }
1938
1938
  }
1939
+ // 宿主悬停卡的专用底色(配合 HOST_PATCH_CSS):宿主把卡片底色写死成 #2C2C2E,
1940
+ // 这里给一个**两档都取暗面**的 token —— 卡片始终是暗底白字(对比度不变),但带上配色色相。
1941
+ if (pairs['--dsw-static-neutral-bluish-850']) {
1942
+ const hoverBg = pairs['--dsw-static-neutral-bluish-850'].dark
1943
+ pairs['--dsh-tp-hovercard-bg'] = { light: hoverBg, dark: hoverBg }
1944
+ }
1939
1945
  // 覆盖层标记(自愈判据用):宿主撤销这一层时它会一起消失。
1940
1946
  pairs[LAYER_MARK] = { light: '1', dark: '1' }
1941
1947
  return pairs
@@ -1996,7 +2002,25 @@ return pairs
1996
2002
  '[class*="_markdown_"] :not(pre) > code{background:var(--dshtp-code-inline,inherit)}',
1997
2003
  ].join('')
1998
2004
 
1999
- /* ================= 设置页样式(head 里第二条 CSS) ================= */
2005
+ /* ================= 宿主补丁样式(head 里第三条 CSS) =================
2006
+ *
2007
+ * 为什么需要它(2026-10-29 用户实测,第二轮回执):
2008
+ * 宿主的「悬停卡」(hover card,会话行悬停时弹出的小卡)把底色**写死在卡片元素上**:
2009
+ * dsh-web-frontend 的 `._card_38jqx_9{--dsw-hovercard-bg:#2C2C2E;background:var(--dsw-hovercard-bg)}`。
2010
+ * 这是一个**手写字面量**(全站唯一的大写 hex),既不读色阶也不读别名 ——
2011
+ * 所以浅色模式下它也是深灰、明暗两套主题下颜色一模一样。改多少条 token 都碰不到它。
2012
+ *
2013
+ * 修法:给一个**专用 token**(`--dsh-tp-hovercard-bg`,见 buildTokens:两档都取色阶 850 的暗色值),
2014
+ * 再用 `*` + `!important` 把它接到宿主的 `--dsw-hovercard-bg` 上 —— 宿主的声明在卡片元素自身,
2015
+ * 普通声明压不过它,必须 important。白字保持不变(暗底白字,对比度不受影响),
2016
+ * 卡片从此带上配色的色相,而不是一块中性的深灰。
2017
+ */
2018
+ const HOST_PATCH_STYLE_ID = 'dsh-theme-palette/host-patch.css'
2019
+ const HOST_PATCH_CSS = `
2020
+ /* 宿主悬停卡:--dsw-hovercard-bg 是宿主写死的 #2C2C2E;这里接回配色的暗面(见 buildTokens 的 --dsh-tp-hovercard-bg) */
2021
+ *{--dsw-hovercard-bg:var(--dsh-tp-hovercard-bg,#2c2c2e)!important}
2022
+ `
2023
+ /* ================= 设置页样式(head 里第四条 CSS) ================= */
2000
2024
  const SETTINGS_STYLE_ID = 'dsh-theme-palette/settings.css'
2001
2025
  const SETTINGS_CSS = `
2002
2026
  .dsh-tp{display:flex;flex-direction:column;gap:14px;width:100%;color:var(--dsw-alias-label-primary);box-sizing:border-box}
@@ -2127,8 +2151,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2127
2151
  }
2128
2152
  }
2129
2153
 
2130
- function installSettingsStyle() {
2131
- try {
2154
+ function installSettingsStyle() { try {
2132
2155
  if (typeof document === 'undefined' || !document.head) return () => {}
2133
2156
  let tag = document.querySelector('style[data-plugin-css="' + SETTINGS_STYLE_ID + '"]')
2134
2157
  if (!tag) {
@@ -2146,6 +2169,25 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2146
2169
  }
2147
2170
  }
2148
2171
 
2172
+ /** 宿主补丁(悬停卡写死的底色)——与另外两条样式同构:覆盖写 + 卸载移除。 */
2173
+ function installHostPatchStyle() {
2174
+ try {
2175
+ if (typeof document === 'undefined' || !document.head) return () => {}
2176
+ let tag = document.querySelector('style[data-plugin-css="' + HOST_PATCH_STYLE_ID + '"]')
2177
+ if (!tag) {
2178
+ tag = document.createElement('style')
2179
+ tag.dataset.plugin = 'dsh-theme-palette'
2180
+ tag.dataset.pluginCss = HOST_PATCH_STYLE_ID
2181
+ document.head.appendChild(tag)
2182
+ }
2183
+ tag.textContent = HOST_PATCH_CSS
2184
+ return () => { if (tag.parentNode) tag.remove() }
2185
+ } catch (err) {
2186
+ console.warn('[dsh-theme-palette] 宿主补丁样式注入失败:', err)
2187
+ return () => {}
2188
+ }
2189
+ }
2190
+
2149
2191
  /* ================= 运行时自检 ================= */
2150
2192
  /**
2151
2193
  * 宿主若改了 token 名,插件会**静默失效**(overrideTokens 照收,样式不生效)。
@@ -2455,7 +2497,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2455
2497
  derive: '由主色派生',
2456
2498
  deriveHint: '用当前强调色的色相与色度推导底色与文字(明暗跟随当前模式)',
2457
2499
  deriveNote: '「由主色派生」以强调色为唯一输入,自动算出底色与文字 —— 会覆盖你手动设置的底色与文字;派生之后仍可逐项手改。',
2458
- notice: '1.13.3:修复左侧会话行悬停卡的底色不跟随主题色——宿主把表面别名写成色阶引用,浮层里这条链不生效;现在 47 个表面别名直接写入覆盖层。',
2500
+ notice: '1.13.4:悬停卡底色不再被宿主写死成中性深灰 —— 接到配色的暗面,白字与对比度不变。',
2459
2501
  dismiss: '知道了',
2460
2502
  explainClamp: '强调色已归一化:{from} → {to}(保证按钮与勾选可读)',
2461
2503
  explainLink: '链接已为可读性压暗:{ratio}:1(目标 {target}:1)',
@@ -2528,7 +2570,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2528
2570
  derive: '由主色派生',
2529
2571
  deriveHint: '用目前強調色的色相與彩度推導底色與文字(明暗跟隨目前模式)',
2530
2572
  deriveNote: '「由主色派生」以強調色為唯一輸入,自動算出底色與文字 —— 會覆蓋你手動設置的底色與文字;派生之後仍可逐項手改。',
2531
- notice: '1.13.3:修正左側會話列懸停卡的底色不跟隨主題色——宿主把表面別名寫成色階引用,浮層裡這條鏈不生效;現在 47 個表面別名直接寫入覆蓋層。',
2573
+ notice: '1.13.4:懸停卡底色不再被宿主寫死成中性深灰 —— 接到配色的暗面,白字與對比度不變。',
2532
2574
  dismiss: '知道了',
2533
2575
  explainClamp: '強調色已正規化:{from} → {to}(確保按鈕與勾選可讀)',
2534
2576
  explainLink: '連結已為可讀性壓暗:{ratio}:1(目標 {target}:1)',
@@ -2601,7 +2643,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2601
2643
  derive: 'Derive from accent',
2602
2644
  deriveHint: 'Derive background and text from the current accent hue and chroma (follows the current light/dark mode)',
2603
2645
  deriveNote: '"Derive from accent" takes the accent as its only input and computes background and text from it — this overwrites the background and text you set by hand; you can still edit each of them afterwards.',
2604
- notice: '1.13.3: fixes the session-row hover card not following the palette — the host declares surface aliases as ramp references and that chain does not resolve inside popovers; all 47 surface aliases now go straight into the override layer.',
2646
+ notice: '1.13.4: the hover card background is no longer the hardcoded neutral dark from the host — it now follows the palette dark surface, keeping white text and contrast.',
2605
2647
  dismiss: 'Got it',
2606
2648
  explainClamp: 'Accent normalised: {from} → {to} (keeps buttons and checks readable)',
2607
2649
  explainLink: 'Link darkened for readability: {ratio}:1 (target {target}:1)',
@@ -2674,7 +2716,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
2674
2716
  derive: 'メイン色から生成',
2675
2717
  deriveHint: '現在のアクセント色の色相と彩度から背景色と文字色を生成します(明暗は現在のモードに従います)',
2676
2718
  deriveNote: '「メイン色から生成」はアクセント色だけを入力として背景色と文字色を自動計算します。手動で設定した背景色と文字色は上書きされます(生成後に個別に変更できます)。',
2677
- notice: '1.13.3:セッション行のホバーカードが配色に追随しない問題を修正——ホストは表面別名を色階の参照で宣言しており、ポップオーバー内ではその連鎖が効きません。47 個の表面別名をオーバーライド層へ直接書き込むようにしました。',
2719
+ notice: '1.13.4:ホバーカードの背景がホスト固定の中立ダークから配色の暗面に切り替わりました(白文字とコントラストはそのまま)。',
2678
2720
  dismiss: '了解',
2679
2721
  explainClamp: 'アクセント色を正規化しました:{from} → {to}(ボタンとチェックの可読性のため)',
2680
2722
  explainLink: 'リンクを可読性のため暗くしました:{ratio}:1(目標 {target}:1)',
@@ -3325,7 +3367,7 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
3325
3367
  // 必须能在测试里读到"实现里的那个数"。此前测试拿 floors() 的返回值当期望值 ——
3326
3368
  // 常量一改、期望值跟着改,那道门就是空转的(变异实测:CONTRAST_FLOOR 4.5→1.0 全绿)。
3327
3369
  if (DEV_OPT_IN && typeof window !== 'undefined' && typeof window.__DSH_THEME_PALETTE_DEV__ === 'function') {
3328
- window.__DSH_THEME_PALETTE_DEV__({ buildTokens, SCHEMES, SIDEBAR_MODES, TEXT_MODES, SCROLL_MODES, CONTROL_MODES, MD_MODES, HC_MODES, contrast, toOklch, fromOklch, flatten, luminance, withAlpha, mixHex, harmonize, deltaE, simulateCvd, rampsFor, floors, floorsDark, apcaContrast, raiseToLc, solveForeground, pickLocale, hostLocale, encodeConfig, decodeConfig, customScheme, deriveCustomFromAccent, readCustom, writeCustom, CONTRAST_SURFACES, CONTRAST_ROLES, buildContrastReport, devContrastReport, CONTRAST_TARGETS, CONTRAST_EXEMPT, CONTRAST_FLOOR, CONTRAST_SOLVER_MARGIN, MIN_MAIN, MIN_SECONDARY, MIN_TERTIARY, MIN_LINK, MIN_LINK_DARK, MIN_SECONDARY_DARK, MIN_TERTIARY_DARK, FLOORS_HC, FLOORS_HC_DARK, RAMP_MIN_GAP, RAMP_ORDER, SURFACE_ALIAS_STEPS, hexToRgb, LAYER_MARK, settingsCss: SETTINGS_CSS, markdownCss: MARKDOWN_CSS, cardColors })
3370
+ window.__DSH_THEME_PALETTE_DEV__({ buildTokens, SCHEMES, SIDEBAR_MODES, TEXT_MODES, SCROLL_MODES, CONTROL_MODES, MD_MODES, HC_MODES, contrast, toOklch, fromOklch, flatten, luminance, withAlpha, mixHex, harmonize, deltaE, simulateCvd, rampsFor, floors, floorsDark, apcaContrast, raiseToLc, solveForeground, pickLocale, hostLocale, encodeConfig, decodeConfig, customScheme, deriveCustomFromAccent, readCustom, writeCustom, CONTRAST_SURFACES, CONTRAST_ROLES, buildContrastReport, devContrastReport, CONTRAST_TARGETS, CONTRAST_EXEMPT, CONTRAST_FLOOR, CONTRAST_SOLVER_MARGIN, MIN_MAIN, MIN_SECONDARY, MIN_TERTIARY, MIN_LINK, MIN_LINK_DARK, MIN_SECONDARY_DARK, MIN_TERTIARY_DARK, FLOORS_HC, FLOORS_HC_DARK, RAMP_MIN_GAP, RAMP_ORDER, SURFACE_ALIAS_STEPS, hexToRgb, LAYER_MARK, hostPatchCss: HOST_PATCH_CSS, settingsCss: SETTINGS_CSS, markdownCss: MARKDOWN_CSS, cardColors })
3329
3371
  }
3330
3372
 
3331
3373
  return {
@@ -3941,10 +3983,12 @@ body[data-ds-dark-theme] .dsh-tp{color-scheme:dark}
3941
3983
  applyAll('boot')
3942
3984
  const removeStyle = installMarkdownStyle()
3943
3985
  const removeSettings = installSettingsStyle()
3986
+ const removeHostPatch = installHostPatchStyle()
3944
3987
  return () => {
3945
3988
  disposeLayer()
3946
3989
  removeStyle()
3947
3990
  removeSettings()
3991
+ removeHostPatch()
3948
3992
  try {
3949
3993
  document.removeEventListener('visibilitychange', healOnVisible)
3950
3994
  window.removeEventListener('focus', healOnFocus)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-theme-palette",
3
- "version": "1.13.3",
3
+ "version": "1.13.4",
4
4
  "description": "DSH 主题配色:4 套配色 × 明暗两模式,OKLCH 色域安全重建 + 真实承载面对比度求解,可调强度与面板表面。",
5
5
  "type": "module",
6
6
  "main": "index.js",