dsh-theme-palette 1.5.2 → 1.5.3
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 +13 -0
- package/client.js +12 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,19 @@
|
|
|
13
13
|
复核宿主源码发现它带 `includePrerelease`,结论相反。现在这条判断固化进脚本,不再靠手算
|
|
14
14
|
- 该改动只影响本地发版工具,**不进 npm 包**(`files` 不含 `tools/`),故不升版本号
|
|
15
15
|
|
|
16
|
+
### 1.5.3
|
|
17
|
+
修:选中「自定义」后滚动条不跟随取色。
|
|
18
|
+
|
|
19
|
+
- **根因**:`scrollbarTokens()` 收到的是 `SCHEMES` 里的**占位** scheme 对象
|
|
20
|
+
(`accentHue` 恒为 60),而真正按三色派生出的参数只在 `rampsFor()` 内部解引用。
|
|
21
|
+
于是画布/强调色都对,唯独滚动条永远停在暖橙。
|
|
22
|
+
- **修法**:`buildTokens()` 开头统一解引用一次(`params = scheme.custom ? customScheme(readCustom()) : scheme`),
|
|
23
|
+
之后所有读 `scheme.*` 的地方改用 `params`;`scrollbarTokens(ramps, params, mode)` 也改传解析后的对象。
|
|
24
|
+
- **防复发**:新增 `tools/check-custom.mjs` —— 断言三种强调色必须产出三种滚动条颜色,
|
|
25
|
+
且三组自选色的正文/次文/三级对比度仍在限内(现在输出
|
|
26
|
+
`#2f6fd0→#bfd6f9 #a9683e→#f2cbb3 #4f7a42→#c2ddbb`)。
|
|
27
|
+
- 顺带:`tools/preview-settings.mjs` 支持 `PREVIEW_ACCENT`,可预览任意强调色的自定义面板。
|
|
28
|
+
|
|
16
29
|
### 1.5.2
|
|
17
30
|
设置页交互重排(用户反馈:自定义不该埋在「更多选项」里、取色看不到即时效果):
|
|
18
31
|
|
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.5.
|
|
30
|
+
const PLUGIN_VERSION = '1.5.3'
|
|
31
31
|
const STORE_KEY = 'dsh-theme-palette.v1'
|
|
32
32
|
const OVERRIDE_SOURCE = 'dsh-theme-palette'
|
|
33
33
|
|
|
@@ -703,9 +703,12 @@ window.__ModuleLoader__.load({
|
|
|
703
703
|
|
|
704
704
|
function buildTokens(scheme, sidebarMode, textMode, rightbarMode, scrollMode, controlMode, mdMode, hcMode) {
|
|
705
705
|
const hc = hcMode === true
|
|
706
|
-
|
|
706
|
+
// 自定义配色必须先解引用:ramps 内部会派生参数,但 accent / scroll / control
|
|
707
|
+
// 这些直接读 params.accentHue、params.hue 的地方若拿到占位值,就会"不跟取色"
|
|
708
|
+
const params = scheme && scheme.custom === true ? customScheme(readCustom()) : scheme
|
|
709
|
+
const ramps = rampsFor(params, textMode || DEFAULT_TEXT, hc)
|
|
707
710
|
const pairs = {}
|
|
708
|
-
if (!
|
|
711
|
+
if (!params.tinted) {
|
|
709
712
|
// 黑白:只输出「被求解改动过」的那几步 + 派生链接,不整条覆盖(保持宿主原貌)
|
|
710
713
|
for (const step of ['400', '600', '700', '1000']) {
|
|
711
714
|
pairs['--dsw-static-neutral-bluish-' + step] = { light: ramps.bluish[step], dark: ramps.bluish[step] }
|
|
@@ -719,7 +722,7 @@ window.__ModuleLoader__.load({
|
|
|
719
722
|
pairs['--dsw-alias-button-primary-fill'] = { light: monoBtn, dark: ramps.bluish['1000'] }
|
|
720
723
|
}
|
|
721
724
|
// 其它配色:整条色阶 + 字面量别名覆盖。
|
|
722
|
-
if (
|
|
725
|
+
if (params.tinted) {
|
|
723
726
|
for (const [family, table] of Object.entries(ramps)) {
|
|
724
727
|
for (const [step, value] of Object.entries(table)) {
|
|
725
728
|
pairs['--dsw-static-' + (family === 'bluish' ? 'neutral-bluish-' : family + '-') + step] = {
|
|
@@ -731,13 +734,13 @@ window.__ModuleLoader__.load({
|
|
|
731
734
|
const aliases = aliasOverrides(ramps, hc)
|
|
732
735
|
for (const [name, pair] of Object.entries(aliases)) pairs[name] = pair
|
|
733
736
|
}
|
|
734
|
-
const sidebar = sidebarTokens(ramps, sidebarMode,
|
|
737
|
+
const sidebar = sidebarTokens(ramps, sidebarMode, params.tinted)
|
|
735
738
|
for (const [name, pair] of Object.entries(sidebar)) pairs[name] = pair
|
|
736
739
|
// 右栏底色只给一个间接层:同左栏时直接引用左栏 token,跟随画布时引用画布 token。
|
|
737
740
|
// 主按钮:浅色下宿主把 button-primary-fill 指到 state-error-primary(红),
|
|
738
741
|
// 于是页面上有「红主按钮 + 强调色」两个主色。改成强调色,并压暗到按钮文字 ≥4.5。
|
|
739
742
|
// 黑白配色在上面已经单独设过,这里跳过(它要按「更浅」档的画布兜底)。
|
|
740
|
-
if (
|
|
743
|
+
if (params.tinted) {
|
|
741
744
|
pairs['--dsw-alias-button-primary-fill'] = {
|
|
742
745
|
light: darkenUntil(ramps.deepseek['500'], ramps.bluish['00'], 4.5),
|
|
743
746
|
dark: ramps.deepseek['400'],
|
|
@@ -756,7 +759,7 @@ window.__ModuleLoader__.load({
|
|
|
756
759
|
: 'var(--dsw-specific-sidebar-fill)'
|
|
757
760
|
pairs['--dshtp-rightbar-fill'] = { light: rightbarFill, dark: rightbarFill }
|
|
758
761
|
// Markdown 强调色:标题 = 正文色混 40% 强调色;加粗 = 混 20%(比标题弱一档)
|
|
759
|
-
if (
|
|
762
|
+
if (params.tinted) {
|
|
760
763
|
if (mdMode === 'off') {
|
|
761
764
|
const inherit = { light: 'inherit', dark: 'inherit' }
|
|
762
765
|
pairs['--dshtp-md-heading'] = inherit
|
|
@@ -790,7 +793,7 @@ window.__ModuleLoader__.load({
|
|
|
790
793
|
light: mixHex(ramps.deepseek['500'], ramps.bluish['50'], 0.05),
|
|
791
794
|
dark: mixHex(ramps.deepseek['400'], ramps.bluish['900'], 0.07),
|
|
792
795
|
}
|
|
793
|
-
const scroll = scrollbarTokens(ramps,
|
|
796
|
+
const scroll = scrollbarTokens(ramps, params, scrollMode)
|
|
794
797
|
for (const [name, pair] of Object.entries(scroll)) pairs[name] = pair
|
|
795
798
|
// 开关/勾选/单选的共用支点:brand-primary 本来是近黑/近白,改成强调色。
|
|
796
799
|
if (controlMode === 'accent') {
|
|
@@ -798,7 +801,7 @@ window.__ModuleLoader__.load({
|
|
|
798
801
|
}
|
|
799
802
|
// 黑白配色的浅色画布本身就是纯白,「更浅」无处可提 —— 改成把会话区压一档浅灰,
|
|
800
803
|
// 侧栏保持纯白,同样得到区块层次(这是唯一需要动画布的情形)。
|
|
801
|
-
if (!
|
|
804
|
+
if (!params.tinted && sidebarMode === 'light') {
|
|
802
805
|
pairs['--dsw-static-neutral-bluish-00'] = { light: '#fafafa', dark: BASE.bluish['00'] }
|
|
803
806
|
}
|
|
804
807
|
return pairs
|