dsh-dracula-theme 0.1.0 → 0.1.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/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ## Preview
14
14
 
15
- ![Dracula skin applied to the DSH Web GUI](assets/preview.webp)
15
+ ![Dracula skin applied to the DSH Web GUI](assets/preview.png)
16
16
 
17
17
  The classic Dracula canvas (`#282a36`) mapped onto the full DSH surface stack — sidebar, conversations, code blocks — with the purple/cyan brand accents from the official Dracula DeepSeek port.
18
18
 
@@ -56,3 +56,11 @@ The token tables are generated: edit the anchors in `palette/dracula.json` (colo
56
56
  ## License
57
57
 
58
58
  MIT — see [LICENSE](LICENSE). Structure modeled on [dsh-catppuccin](https://github.com/zhijun-dai/Catppuccin-dsh-theme) (MIT); token mapping adopted from the official [Dracula DeepSeek port](https://github.com/dracula/deepseek) (MIT).
59
+
60
+ ## Development workflow
61
+
62
+ 1. Edit the anchors in `palette/dracula.json` — colors, the official canvas/brand/code mappings, `grayRamp`, `soft.background`.
63
+ 2. `npm run generate` — rebuilds `themes/*.json` and `lib/client.js` (the browser bundle).
64
+ 3. Validate: `node scripts/check-themes.mjs` (structural token check) — CI runs the same check plus a generated-artifacts diff.
65
+ 4. Test in a live profile: `dsh plugin --profile web add /path/to/this/repo` (local link), restart the profile, pick a skin in **Settings → General → Dracula theme**.
66
+ 5. Release: bump `version` in `package.json`, commit, push, `pnpm publish`, then update the profile to the published version (`dsh plugin --profile web add dsh-dracula-theme`) and restart the app. The profile installs from npm, not from the working tree — local edits only take effect after publishing or via a local link.
package/README.zh.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ## 预览
14
14
 
15
- ![德古拉主题应用在 DSH Web GUI 上的效果](assets/preview.webp)
15
+ ![德古拉主题应用在 DSH Web GUI 上的效果](assets/preview.png)
16
16
 
17
17
  经典德古拉画布(`#282a36`)映射到 DSH 全部界面层 —— 侧边栏、会话、代码块,品牌点缀色取自官方 Dracula DeepSeek 移植版的紫/青配色。
18
18
 
@@ -55,3 +55,11 @@ token 表是生成出来的:修改 `palette/dracula.json` 里的锚点(颜
55
55
  ## 许可
56
56
 
57
57
  MIT —— 见 [LICENSE](LICENSE)。结构参考 [dsh-catppuccin](https://github.com/zhijun-dai/Catppuccin-dsh-theme)(MIT)。
58
+
59
+ ## 开发工作流
60
+
61
+ 1. 修改 `palette/dracula.json` 里的锚点——颜色、官方 canvas/brand/代码映射、`grayRamp`、`soft.background`。
62
+ 2. `npm run generate` —— 重新生成 `themes/*.json` 与 `lib/client.js`(浏览器 bundle)。
63
+ 3. 校验:`node scripts/check-themes.mjs`(token 结构检查)——CI 会跑同样的检查,外加生成产物 diff。
64
+ 4. 在真实 profile 里测试:`dsh plugin --profile web add /path/to/this/repo`(本地 link),重启 profile,在**设置 → 通用 → 德古拉主题**里选择皮肤。
65
+ 5. 发版:`package.json` 升 `version`,提交推送,`pnpm publish`,再把 profile 更新到已发布版本(`dsh plugin --profile web add dsh-dracula-theme`)并重启应用。profile 从 npm 安装,不走工作区——本地改动只有发布后(或通过本地 link)才会生效。
Binary file
package/lib/client.js CHANGED
@@ -45,7 +45,9 @@ window.__ModuleLoader__.load({
45
45
  "tokens": {
46
46
  "--dsw-static-neutral-50": "#efefe9",
47
47
  "--dsw-static-neutral-100": "#e2e2da",
48
+ "--dsw-static-neutral-150": "#d8d8d0",
48
49
  "--dsw-static-neutral-200": "#cdcdc5",
50
+ "--dsw-static-neutral-250": "#c2c2ba",
49
51
  "--dsw-static-neutral-300": "#b6b6ae",
50
52
  "--dsw-static-neutral-400": "#8f8f96",
51
53
  "--dsw-static-neutral-500": "#6d6d7a",
@@ -56,7 +58,6 @@ window.__ModuleLoader__.load({
56
58
  "--dsw-static-neutral-850": "#282a36",
57
59
  "--dsw-static-neutral-900": "#20212b",
58
60
  "--dsw-static-neutral-1000": "#191a21",
59
- "--dsw-static-neutral-description": "Anchor stops of the neutral grayscale ramp (--dsw-static-neutral-*), lightest (00) to darkest (1000). The official port does not override this ramp; values are Dracula-gray interpolations for a self-contained theme.",
60
61
  "--dsw-static-neutral-00": "#f8f8f2",
61
62
  "--dsw-static-neutral-bluish-50": "#f8f8f2",
62
63
  "--dsw-static-neutral-bluish-60": "#282a36",
@@ -89,7 +90,6 @@ window.__ModuleLoader__.load({
89
90
  "--dsw-static-deepseek-600": "#7a5abf",
90
91
  "--dsw-static-deepseek-800": "#44475a",
91
92
  "--dsw-static-deepseek-900": "#383a4a",
92
- "--dsw-static-deepseek-description": "--dsw-static-deepseek-* overrides from the official port. 400 link / brand-text → cyan, 450 brand-primary → purple, 500 hover.",
93
93
  "--dsw-static-deepseek-700-delete": "#5a3e99",
94
94
  "--dsw-static-blue-50": "#eafcff",
95
95
  "--dsw-static-blue-75": "#c6f3fd",
@@ -208,7 +208,6 @@ window.__ModuleLoader__.load({
208
208
  "--dsw-specific-menu": "#2e3040",
209
209
  "--dsw-specific-selector": "#44475a",
210
210
  "--dsw-specific-tip": "#2e3040",
211
- "--shiki-description": "The official Prism token mapping, translated to the DSH shiki vocabulary: comments #6272a4, punctuation #f8f8f2, tags/parameters/this → cyan, numbers/constants/strings/inserted → yellow, keywords/operators/builtins/regex → pink, functions → green, deleted/important → red.",
212
211
  "--shiki-foreground": "#f8f8f2",
213
212
  "--shiki-background": "#282a36",
214
213
  "--shiki-token-comment": "#6272a4",
@@ -234,7 +233,9 @@ window.__ModuleLoader__.load({
234
233
  "tokens": {
235
234
  "--dsw-static-neutral-50": "#efefe9",
236
235
  "--dsw-static-neutral-100": "#e2e2da",
236
+ "--dsw-static-neutral-150": "#d8d8d0",
237
237
  "--dsw-static-neutral-200": "#cdcdc5",
238
+ "--dsw-static-neutral-250": "#c2c2ba",
238
239
  "--dsw-static-neutral-300": "#b6b6ae",
239
240
  "--dsw-static-neutral-400": "#8f8f96",
240
241
  "--dsw-static-neutral-500": "#6d6d7a",
@@ -245,7 +246,6 @@ window.__ModuleLoader__.load({
245
246
  "--dsw-static-neutral-850": "#282a36",
246
247
  "--dsw-static-neutral-900": "#20212b",
247
248
  "--dsw-static-neutral-1000": "#191a21",
248
- "--dsw-static-neutral-description": "Anchor stops of the neutral grayscale ramp (--dsw-static-neutral-*), lightest (00) to darkest (1000). The official port does not override this ramp; values are Dracula-gray interpolations for a self-contained theme.",
249
249
  "--dsw-static-neutral-00": "#f8f8f2",
250
250
  "--dsw-static-neutral-bluish-50": "#f8f8f2",
251
251
  "--dsw-static-neutral-bluish-60": "#282a36",
@@ -278,7 +278,6 @@ window.__ModuleLoader__.load({
278
278
  "--dsw-static-deepseek-600": "#7a5abf",
279
279
  "--dsw-static-deepseek-800": "#44475a",
280
280
  "--dsw-static-deepseek-900": "#383a4a",
281
- "--dsw-static-deepseek-description": "--dsw-static-deepseek-* overrides from the official port. 400 link / brand-text → cyan, 450 brand-primary → purple, 500 hover.",
282
281
  "--dsw-static-deepseek-700-delete": "#5a3e99",
283
282
  "--dsw-static-blue-50": "#eafcff",
284
283
  "--dsw-static-blue-75": "#c6f3fd",
@@ -397,7 +396,6 @@ window.__ModuleLoader__.load({
397
396
  "--dsw-specific-menu": "#343746",
398
397
  "--dsw-specific-selector": "#44475a",
399
398
  "--dsw-specific-tip": "#343746",
400
- "--shiki-description": "The official Prism token mapping, translated to the DSH shiki vocabulary: comments #6272a4, punctuation #f8f8f2, tags/parameters/this → cyan, numbers/constants/strings/inserted → yellow, keywords/operators/builtins/regex → pink, functions → green, deleted/important → red.",
401
399
  "--shiki-foreground": "#f8f8f2",
402
400
  "--shiki-background": "#282a36",
403
401
  "--shiki-token-comment": "#6272a4",
@@ -456,13 +454,49 @@ window.__ModuleLoader__.load({
456
454
  }
457
455
  }
458
456
 
459
- /** Saved skin id (may be unknown/absent). */
457
+ /**
458
+ * The DSH Desktop client boots its web app on a fresh random port
459
+ * every launch (`--port 0`), and localStorage is scoped per origin —
460
+ * including the port. A choice saved under http://127.0.0.1:55337 is
461
+ * invisible to the next launch at http://127.0.0.1:49562, so the
462
+ * theme silently reverts to default on every desktop start.
463
+ * Cookies, by contrast, are scoped per host and ignore the port, and
464
+ * the desktop client keeps a persistent cookie jar. So the saved
465
+ * skin is mirrored into a host-scoped cookie; reads prefer the
466
+ * cookie and fall back to localStorage (the plain `dsh web` browser
467
+ * session keeps its fixed-port origin, where both stores agree).
468
+ */
469
+ const COOKIE_KEY = "dsh-dracula-skin";
470
+ const COOKIE_MAX_AGE = 60 * 60 * 24 * 400;
471
+
472
+ /** Read a cookie value (null on absence). */
473
+ function readCookie(name) {
474
+ try {
475
+ const match = document.cookie.match(new RegExp(`(?:^|;\\s*)${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}=([^;]*)`));
476
+ return match ? decodeURIComponent(match[1]) : null;
477
+ } catch {
478
+ return null;
479
+ }
480
+ }
481
+
482
+ /** Write (or remove with max-age=0) a cookie. */
483
+ function writeCookie(name, value) {
484
+ try {
485
+ if (value === null) document.cookie = `${name}=; path=/; max-age=0`;
486
+ else document.cookie = `${name}=${encodeURIComponent(value)}; path=/; max-age=${COOKIE_MAX_AGE}`;
487
+ } catch {
488
+ // storage unavailable — the preference stays process-local
489
+ }
490
+ }
491
+
492
+ /** Saved skin id (may be unknown/absent): cookie first, localStorage fallback. */
460
493
  function readSavedSkin() {
461
- return readStorage(STORAGE_KEY);
494
+ return readCookie(COOKIE_KEY) ?? readStorage(STORAGE_KEY);
462
495
  }
463
496
 
464
497
  /** Persist a skin choice; DEFAULT_SKIN clears the stored value. */
465
498
  function writeSavedSkin(id) {
499
+ writeCookie(COOKIE_KEY, id === DEFAULT_SKIN ? null : id);
466
500
  writeStorage(STORAGE_KEY, id === DEFAULT_SKIN ? null : id);
467
501
  }
468
502
  //#endregion
@@ -765,29 +799,51 @@ window.__ModuleLoader__.load({
765
799
  style.remove();
766
800
  }, "dsh-dracula-theme: surface tint lifecycle");
767
801
 
768
- // Restore the saved skin. The ThemeService adopts its durable
769
- // built-in preference ("light"/"dark"/"system") from the Host
770
- // settings scope asynchronously after boot, which overwrites a
771
- // third-party preference restored too early. Re-assert the saved
772
- // skin for a short boot window (a handful of change events or a
773
- // few seconds), then yield to subsequent user actions.
802
+ // Restore the saved skin against the boot adoption storm. The
803
+ // ThemeService adopts its durable built-in preference
804
+ // ("light"/"dark"/"system") from the Host settings scope
805
+ // asynchronously after boot; every adoption emits theme/change
806
+ // with a built-in preference that overwrites a third-party one.
807
+ // In slower boot paths the desktop client's RPC bridge emits
808
+ // more, later sync events — a fixed retry budget (a handful of
809
+ // tries within a few seconds) can be exhausted and the theme
810
+ // silently reverts to default. So instead of a time-boxed guard
811
+ // we stay armed while the storm is active: re-assert the saved
812
+ // skin on every built-in revert, and only yield to user actions
813
+ // once the preference has rested on the saved skin for a quiet
814
+ // period with no further adoption events.
774
815
  const saved = readSavedSkin();
775
816
  const savedValid = typeof saved === "string" && saved !== DEFAULT_SKIN && SKINS.some((skinDefinition) => skinDefinition.id === saved);
776
- let bootGuard = savedValid ? 3 : 0;
777
- const reassertSaved = () => {
778
- if (bootGuard <= 0) return;
779
- const current = ctx.theme.getTheme().preference;
780
- if (current === saved) return;
781
- bootGuard -= 1;
782
- ctx.theme.setTheme(saved);
817
+ let armed = savedValid;
818
+ let quietTimer;
819
+ const disarm = () => {
820
+ armed = false;
821
+ };
822
+ const scheduleDisarm = () => {
823
+ clearTimeout(quietTimer);
824
+ quietTimer = setTimeout(disarm, 4000);
825
+ };
826
+ const reassertAgainstAdoption = () => {
827
+ if (!armed) return;
828
+ const pref = ctx.theme.getTheme().preference;
829
+ if (pref === saved) {
830
+ scheduleDisarm();
831
+ return;
832
+ }
833
+ if (pref === "light" || pref === "dark" || pref === DEFAULT_SKIN) {
834
+ // A built-in won — during boot this can only be a scope
835
+ // adoption (nobody reaches the Appearance row that fast).
836
+ // Re-assert, then require another quiet period.
837
+ ctx.theme.setTheme(saved);
838
+ scheduleDisarm();
839
+ }
840
+ // Another third-party theme — the drop-foreign convention
841
+ // below clears our stored choice instead of fighting.
783
842
  };
784
- reassertSaved();
785
- const bootWindow = setTimeout(() => {
786
- bootGuard = 0;
787
- }, 5000);
843
+ reassertAgainstAdoption();
788
844
  ctx.effect(() => () => {
789
- clearTimeout(bootWindow);
790
- }, "dsh-dracula: boot restore window");
845
+ clearTimeout(quietTimer);
846
+ }, "dsh-dracula-theme: boot restore lifecycle");
791
847
 
792
848
  const skinStore = createSkinStore();
793
849
  let skinBound;
@@ -807,7 +863,7 @@ window.__ModuleLoader__.load({
807
863
  // dispatch is missed by other subscribers (ui-layout's
808
864
  // ThemePresenter), so the restored skin would never reach the DOM.
809
865
  setTimeout(() => {
810
- reassertSaved();
866
+ reassertAgainstAdoption();
811
867
  }, 0);
812
868
  });
813
869
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dracula-theme",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "🧛 Dracula theme for DeepSeek Harness: the classic dark palette (plus the Soft variant) registered into the built-in theme runtime",
5
5
  "license": "MIT",
6
6
  "author": "ossFrankFrank",
@@ -29,7 +29,8 @@
29
29
  "lib/index.js",
30
30
  "lib/client.js",
31
31
  "cordis.patch.yml",
32
- "themes"
32
+ "themes",
33
+ "assets"
33
34
  ],
34
35
  "dsh": {
35
36
  "bundle": {
@@ -5,7 +5,9 @@
5
5
  "tokens": {
6
6
  "--dsw-static-neutral-50": "#efefe9",
7
7
  "--dsw-static-neutral-100": "#e2e2da",
8
+ "--dsw-static-neutral-150": "#d8d8d0",
8
9
  "--dsw-static-neutral-200": "#cdcdc5",
10
+ "--dsw-static-neutral-250": "#c2c2ba",
9
11
  "--dsw-static-neutral-300": "#b6b6ae",
10
12
  "--dsw-static-neutral-400": "#8f8f96",
11
13
  "--dsw-static-neutral-500": "#6d6d7a",
@@ -16,7 +18,6 @@
16
18
  "--dsw-static-neutral-850": "#282a36",
17
19
  "--dsw-static-neutral-900": "#20212b",
18
20
  "--dsw-static-neutral-1000": "#191a21",
19
- "--dsw-static-neutral-description": "Anchor stops of the neutral grayscale ramp (--dsw-static-neutral-*), lightest (00) to darkest (1000). The official port does not override this ramp; values are Dracula-gray interpolations for a self-contained theme.",
20
21
  "--dsw-static-neutral-00": "#f8f8f2",
21
22
  "--dsw-static-neutral-bluish-50": "#f8f8f2",
22
23
  "--dsw-static-neutral-bluish-60": "#282a36",
@@ -49,7 +50,6 @@
49
50
  "--dsw-static-deepseek-600": "#7a5abf",
50
51
  "--dsw-static-deepseek-800": "#44475a",
51
52
  "--dsw-static-deepseek-900": "#383a4a",
52
- "--dsw-static-deepseek-description": "--dsw-static-deepseek-* overrides from the official port. 400 link / brand-text → cyan, 450 brand-primary → purple, 500 hover.",
53
53
  "--dsw-static-deepseek-700-delete": "#5a3e99",
54
54
  "--dsw-static-blue-50": "#eafcff",
55
55
  "--dsw-static-blue-75": "#c6f3fd",
@@ -168,7 +168,6 @@
168
168
  "--dsw-specific-menu": "#343746",
169
169
  "--dsw-specific-selector": "#44475a",
170
170
  "--dsw-specific-tip": "#343746",
171
- "--shiki-description": "The official Prism token mapping, translated to the DSH shiki vocabulary: comments #6272a4, punctuation #f8f8f2, tags/parameters/this → cyan, numbers/constants/strings/inserted → yellow, keywords/operators/builtins/regex → pink, functions → green, deleted/important → red.",
172
171
  "--shiki-foreground": "#f8f8f2",
173
172
  "--shiki-background": "#282a36",
174
173
  "--shiki-token-comment": "#6272a4",
@@ -5,7 +5,9 @@
5
5
  "tokens": {
6
6
  "--dsw-static-neutral-50": "#efefe9",
7
7
  "--dsw-static-neutral-100": "#e2e2da",
8
+ "--dsw-static-neutral-150": "#d8d8d0",
8
9
  "--dsw-static-neutral-200": "#cdcdc5",
10
+ "--dsw-static-neutral-250": "#c2c2ba",
9
11
  "--dsw-static-neutral-300": "#b6b6ae",
10
12
  "--dsw-static-neutral-400": "#8f8f96",
11
13
  "--dsw-static-neutral-500": "#6d6d7a",
@@ -16,7 +18,6 @@
16
18
  "--dsw-static-neutral-850": "#282a36",
17
19
  "--dsw-static-neutral-900": "#20212b",
18
20
  "--dsw-static-neutral-1000": "#191a21",
19
- "--dsw-static-neutral-description": "Anchor stops of the neutral grayscale ramp (--dsw-static-neutral-*), lightest (00) to darkest (1000). The official port does not override this ramp; values are Dracula-gray interpolations for a self-contained theme.",
20
21
  "--dsw-static-neutral-00": "#f8f8f2",
21
22
  "--dsw-static-neutral-bluish-50": "#f8f8f2",
22
23
  "--dsw-static-neutral-bluish-60": "#282a36",
@@ -49,7 +50,6 @@
49
50
  "--dsw-static-deepseek-600": "#7a5abf",
50
51
  "--dsw-static-deepseek-800": "#44475a",
51
52
  "--dsw-static-deepseek-900": "#383a4a",
52
- "--dsw-static-deepseek-description": "--dsw-static-deepseek-* overrides from the official port. 400 link / brand-text → cyan, 450 brand-primary → purple, 500 hover.",
53
53
  "--dsw-static-deepseek-700-delete": "#5a3e99",
54
54
  "--dsw-static-blue-50": "#eafcff",
55
55
  "--dsw-static-blue-75": "#c6f3fd",
@@ -168,7 +168,6 @@
168
168
  "--dsw-specific-menu": "#2e3040",
169
169
  "--dsw-specific-selector": "#44475a",
170
170
  "--dsw-specific-tip": "#2e3040",
171
- "--shiki-description": "The official Prism token mapping, translated to the DSH shiki vocabulary: comments #6272a4, punctuation #f8f8f2, tags/parameters/this → cyan, numbers/constants/strings/inserted → yellow, keywords/operators/builtins/regex → pink, functions → green, deleted/important → red.",
172
171
  "--shiki-foreground": "#f8f8f2",
173
172
  "--shiki-background": "#282a36",
174
173
  "--shiki-token-comment": "#6272a4",