@nonamelego/dsh-catppuccin 0.3.1 → 0.4.1

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
@@ -33,15 +33,14 @@
33
33
 
34
34
  ## 简介
35
35
 
36
- [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Web GUI
37
- (`dsh web`)的 [Catppuccin](https://github.com/catppuccin/catppuccin) 主题插件。
36
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
37
+ [Catppuccin](https://github.com/catppuccin/catppuccin) 主题插件——一个包同时适配
38
+ **Web GUI**(`dsh web`)、**DSH Desktop** 与 **dsh-TUI** 终端:Web / 桌面端做全界面换色与玻璃质感,
39
+ TUI 端自动同步四套官方主题色板。
38
40
 
39
41
  它内置 Catppuccin 的四个主题——**Latte**、**Frappé**、**Macchiato**、**Mocha**——
40
42
  把整个界面的配色都换成对应的 Catppuccin 色板;并在 **设置 → 常规 → 外观**
41
- 下方提供一行 **Catppuccin** 快捷切换,选择会自动保存、重启自动恢复——
42
- 偏好持久保存在 DSH home 下的 `catppuccin-state.json`(浏览器 localStorage
43
- 作为同机的即时缓存),因此即使在 **DSH Desktop** 里每次启动端口都变化,
44
- 主题和玻璃设置也能跨重启稳定恢复。
43
+ 下方提供一行 **Catppuccin** 快捷切换,选择会自动保存、重启自动恢复。
45
44
 
46
45
  同时内置一套可开关的**玻璃质感**(Glassmorphism)皮肤:顶栏、侧边栏、
47
46
  输入框、统计行、轨迹视图、聊天气泡、新会话按钮都变成磨砂玻璃卡片,
@@ -52,7 +51,7 @@ Catppuccin 主题。
52
51
 
53
52
  - 🎨 四个主题:Latte(浅色)、Frappé / Macchiato / Mocha(深色)
54
53
  - 🧩 接入官方主题系统,与内置浅色 / 深色 / 跟随系统主题平级
55
- - 🎯 全界面配色覆盖(162 个配色变量),不只是一两个强调色
54
+ - 🎯 全界面配色覆盖,不只是一两个强调色
56
55
  - ⚙️ 设置页一行切换,选择自动保存、重启自动恢复
57
56
  - 🌐 中英文双语文案(跟随系统语言)
58
57
  - 🪟 **玻璃质感**:顶栏 / 侧边栏 / 输入框 / 统计行 / 轨迹视图 / 聊天气泡 /
@@ -60,8 +59,9 @@ Catppuccin 主题。
60
59
  背景亮度自由调节(交互参考 [DSH-Transparent-UI-Plugin](https://github.com/WYH66666666/DSH-Transparent-UI-Plugin))
61
60
  - 🌫️ **玻璃拟态细节**:页面上下边缘渐变模糊、折叠侧边栏悬浮玻璃、
62
61
  纯色背景跟随主题底色——内容滚入视口边缘时柔化穿过,层次更立体
63
- - 🎨 玻璃配色取自当前主题的 token(color-mix 自动跟随四个 Catppuccin 色板)
62
+ - 🎨 玻璃配色自动跟随当前 Catppuccin 主题
64
63
  - 🔄 **检查 Catppuccin 插件更新**:设置页一键检测本插件(dsh-catppuccin)在 npm 上的最新版本,发现新版直接给出可复制的升级命令
64
+ - 💻 **dsh-TUI 终端主题**:一条安装命令装进 dsh-TUI,四套主题自动同步到 `~/.dsh-tui/themes/`,见[安装 · dsh-TUI](#dsh-tui-终端版主题)
65
65
 
66
66
  ## 预览
67
67
 
@@ -120,9 +120,8 @@ dsh plugin --profile web add @nonamelego/dsh-catppuccin
120
120
  dsh plugin --profile desktop add @nonamelego/dsh-catppuccin
121
121
  ```
122
122
 
123
- 在桌面的 **DSH 终端**里运行即可(终端里的 `dsh plugin` 默认就作用于当前激活的
124
- profile,也可以直接写 `dsh plugin add @nonamelego/dsh-catppuccin`;若你在托盘里
125
- 选了别的 profile,就把 `desktop` 换成那个名字),装完重启 **[DSH Desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** 生效。
123
+ 在桌面的 **DSH 终端**里运行即可(`dsh plugin` 默认作用于当前激活的 profile,
124
+ 若在托盘里选了别的 profile 就换成那个名字),装完重启 **[DSH Desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** 生效。
126
125
  从仓库安装的方式同理:`dsh plugin --profile desktop add https://github.com/NoNameLeGo/dsh-catppuccin-theme`。
127
126
 
128
127
  ### 方式二:从仓库安装
@@ -134,17 +133,32 @@ dsh plugin --profile web add https://github.com/NoNameLeGo/dsh-catppuccin-theme
134
133
  从 git 安装时 pnpm 可能要求允许构建脚本——按 pnpm 的提示把对应包加进 profile
135
134
  `pnpm-workspace.yaml` 的 `allowBuilds` 后重跑一次即可。
136
135
 
137
- ### 方式三:本地链接(开发调试用)
136
+ ### dsh-TUI(终端版)主题
138
137
 
139
- 克隆到本地后,把包链接进 profile 并加入 bundles(下面的路径换成你自己的):
138
+ Web GUI 插件同一个包。用标准的插件安装命令装进 dsh-tui profile:
140
139
 
141
140
  ```sh
142
- pnpm --dir C:\Users\LeGo\.dsh\profiles\web add link:D:\Vibe-Coding\dsh-catppuccin
141
+ dsh plugin --profile dsh-tui add @nonamelego/dsh-catppuccin
142
+ ```
143
+
144
+ 从仓库安装同理(npm 版尚未发版时可用 git 形式,效果一致):
145
+
146
+ ```sh
147
+ dsh plugin --profile dsh-tui add https://github.com/NoNameLeGo/dsh-catppuccin-theme
143
148
  ```
144
149
 
145
- 然后在 profile `package.json` 中把 `@nonamelego/dsh-catppuccin` 加进 `dsh.profile.bundles`,
146
- 重启 `dsh web` 即可。在 [DSH Desktop](https://github.com/anywhere-labs/deepseek-harness-desktop) 中使用时,把上面的路径换成桌面 profile
147
- (默认 `desktop`,位于 `~/.dsh/profiles/desktop`),装完重启 **[DSH Desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** 即可。
150
+ 包里带一个只做主题同步的小插件行(`dsh-catppuccin-tui-themes`,不依赖任何服务):dsh-TUI 启动时自动把四套主题 JSON 同步到 `~/.dsh-tui/themes/`,之后升级包即同步新版配色。装完启动 `dsh --profile dsh-tui`,在 dsh-TUI 里用 `/theme` 选择 **Catppuccin Latte / Frappé / Macchiato / Mocha**,或直接 `/theme catppuccin-mocha` 切换(选择会持久化,下次启动自动恢复)。
151
+
152
+ > 💡 已为 Web GUI 装过本插件、同时用 dsh-TUI 的话,无需重复安装:Web 端每次
153
+ > 启动会自动同步主题到 `~/.dsh-tui/themes/`(仅当该目录已存在)。
154
+
155
+ > 📁 不想装包也可手动复制:把 `themes/*.json` 拷进 `~/.dsh-tui/themes/`
156
+ > (Windows:`%USERPROFILE%\.dsh-tui\themes\`),只是不随版本自动更新。
157
+
158
+ > ⚠️ `catppuccin-*.json` 归本插件所有、同步时会被覆盖;想自定义请改名另存。
159
+
160
+ > 💡 TUI 主题只管 TUI 内部配色,终端背景由你的终端决定——建议也配上对应
161
+ > 风味的 Catppuccin(见 [Catppuccin ports 列表](https://github.com/catppuccin/catppuccin#-ports)),观感最一致。
148
162
 
149
163
  ## 使用
150
164
 
@@ -170,67 +184,39 @@ pnpm --dir C:\Users\LeGo\.dsh\profiles\web add link:D:\Vibe-Coding\dsh-catppucci
170
184
  - **背景亮度**:深色模式 0–50 压暗、浅色模式 50–100 提亮(50 为原样),
171
185
  直接调和进纯色背景。
172
186
 
173
- 玻璃配色取自当前主题的设计 token,切换 Latte / Frappé / Macchiato / Mocha
174
- 时玻璃颜色自动跟随;设置最终持久保存在 DSH home 下的
175
- `catppuccin-state.json`(同主题一起,跨重启、跨端口恢复),浏览器
176
- localStorage 只作为即时缓存与多标签页同步——**DSH Desktop** 每次启动使用
177
- 不同的随机回环端口,localStorage 因此无法跨重启保留,而 DSH home 下的文件
178
- 不受端口影响,重启后自动恢复。
187
+ 玻璃配色自动跟随当前主题,切换 Latte / Frappé / Macchiato / Mocha 时即时
188
+ 变色;所有设置跨重启自动恢复。
179
189
 
180
190
  ### 检查 Catppuccin 插件更新
181
191
 
182
192
  在 **设置 → 常规** 的 **玻璃质感** 正下方找到 **检查 Catppuccin 插件更新** 行:
183
193
 
184
- - 点击 **检查更新**,插件宿主会查询 npm registry 上本插件(`dsh-catppuccin`)
185
- 的最新版本,并与当前安装版本比较(含预发布版本的语义化版本比较);
186
- 宿主侧对检查结果缓存 5 分钟,短时间内反复点击不会重复请求 registry。
187
- - 已是最新 显示当前版本号;发现新版 显示新版本号,并给出可复制的
188
- 升级命令。命令中的 profile 名由宿主**自动探测**:优先取当前进程的
189
- `--profile` 参数,否则扫描 `~/.dsh/profiles/*` 找到实际安装了本插件的
190
- profile,无需手动替换(探测失败时才回退为 `web` 并提示手动确认)。
191
- - 检测到本插件为本地链接 / 源码安装(`link:` / `file:` / git)时会给出
192
- 提示:npm 升级命令不适用,应改用 `git pull` 或重新构建。
193
- - 通道策略:正式版安装只跟随 `latest` 标签;预发布版安装同时跟随
194
- `beta` 标签(升级命令自动用 `@beta`),正式版超过你的预发布版本时提示
195
- 升级到 `@latest`。
196
- - 检查走宿主进程的 Node fetch(无跨域问题);离线或 registry 不可达时
197
- 显示具体失败原因并支持重试。
198
- - **环境自适配**:在 [DSH Desktop](https://github.com/anywhere-labs/deepseek-harness-desktop) 中运行时,目标 profile 直接取桌面版的
199
- 当前 profile(不靠扫描猜测),提示与重启文案也切换为 Desktop 口径
200
- (DSH 终端);普通 dsh web / CLI 下保持原有终端命令。
194
+ - 点击 **检查更新** 即对比 npm 上的最新版与当前版本:已是最新 → 显示当前
195
+ 版本号;发现新版 → 显示新版本号并给出可复制的升级命令(命令中的 profile
196
+ 名自动探测,无需手动替换;探测失败才回退为 `web`)。
197
+ - 本插件为本地链接 / 源码安装(`link:` / `file:` / git)时不显示 npm 升级
198
+ 命令,会提示改用 `git pull` 或重新构建。
199
+ - 通道策略:正式版只跟随 `latest` 标签;预发布版同时跟随 `beta`(升级命令
200
+ 自动带 `@beta`)。离线或网络失败时显示原因并可重试。
201
201
 
202
202
  ## 玻璃拟态(Glassmorphism)
203
203
 
204
- **玻璃拟态**是一种视觉风格:让界面面板像一片磨砂玻璃,透过它能看到背后的
205
- 内容。它的三个关键要素是——
204
+ **玻璃拟态**是一种视觉风格:界面面板像一片磨砂玻璃——半透明填充、
205
+ 背景模糊(`backdrop-filter: blur()`)和玻璃细节(描边、内高光、柔和投影),
206
+ 透过它能看到并柔化背后的内容。
206
207
 
207
- 1. **半透明填充**:面板本身不画实底色,而是半透明的「玻璃」;
208
- 2. **背景模糊**(`backdrop-filter: blur()`):面板背后的内容(聊天记录、
209
- 页面底色)透过玻璃被柔化,与前景文字拉开层次;
210
- 3. **玻璃细节**:细描边、内高光、柔和投影和较大圆角,模拟玻璃的厚度与边缘。
208
+ 本插件的具体效果:
211
209
 
212
- 本插件的实现方式:
213
-
214
- - **配色自动跟随主题**:玻璃填充用 `color-mix()` 把当前主题的 token
215
- (`--dsw-alias-bg-layer-1/2`)按磨砂度混合成半透明色,所以 Latte 是浅色
216
- 玻璃、Mocha 是深色玻璃,切换主题玻璃颜色即时跟随,无需额外配置;
217
210
  - **七个区域玻璃化**:顶栏、侧边栏、输入框、统计行、轨迹视图、聊天气泡
218
- 和新会话按钮都变成磨砂玻璃;云母模式下它们成为带圆角的悬浮卡片,聊天
219
- 内容滚动时会从顶栏玻璃下方穿过、被模糊;折叠侧边栏时导航条同样以悬浮
220
- 玻璃浮在聊天区边缘;
211
+ 和新会话按钮;云母模式下成为带圆角的悬浮卡片,聊天内容滚动时从玻璃
212
+ 下方穿过、被模糊;折叠侧边栏时导航条同样悬浮在聊天区边缘;
221
213
  - **页面边缘渐变模糊**:视口上下各有一条渐变模糊带,消息滚到边缘时被
222
- 柔化穿过——玻璃卡片保持清晰,内容在边界「融化」(借鉴
214
+ 柔化穿过——内容在边界「融化」(借鉴
223
215
  [DSH-Transparent-UI-Plugin](https://github.com/WYH66666666/DSH-Transparent-UI-Plugin)
224
216
  的 Aqua 皮肤);
225
- - **纯色背景**:页面底色就是当前主题的 `bg-base` 纯色(Latte `#eff1f5` /
226
- Frappé `#303446` / Macchiato `#24273a` / Mocha `#1e1e2e`),零硬编码、
227
- 切色板自动跟随;背景亮度旋钮直接往这个纯色里调和白/黑;
228
- - **一键开关**:整个效果由 `data-dsh-glass` 属性统一门控,关闭即完全还原
229
- 原生界面,插件卸载时不留任何残留;无心智负担的 z-index 层级整理(侧边栏
230
- 9 / 顶栏与输入框 8)保证设置面板、浮动卡片互不遮挡;
231
- - 交互与实现思路参考了
232
- [DSH-Transparent-UI-Plugin](https://github.com/WYH66666666/DSH-Transparent-UI-Plugin)
233
- (Aqua 玻璃皮肤)的云母 / 兼容双模式与旋钮设计。
217
+ - **配色自动跟随主题**:Latte 是浅色玻璃、Mocha 是深色玻璃,切换主题即时
218
+ 变色;页面底色取当前主题纯色,背景亮度旋钮直接往纯色里调和白/黑;
219
+ - **一键开关**:关闭即完全还原原生界面,插件卸载不留任何残留。
234
220
 
235
221
  ## 开发
236
222
 
@@ -247,6 +233,18 @@ pnpm build # tsdown 构建 -> lib/index.js(服务端)+ lib/client.js
247
233
  node scripts/generate-palettes.mjs
248
234
  ```
249
235
 
236
+ ### 本地链接调试
237
+
238
+ 克隆到本地后,把包链接进 profile 并加入 bundles(路径换成你自己的):
239
+
240
+ ```sh
241
+ pnpm --dir C:\Users\LeGo\.dsh\profiles\web add link:D:\Vibe-Coding\dsh-catppuccin
242
+ ```
243
+
244
+ 再把 `@nonamelego/dsh-catppuccin` 加进 profile `package.json` 的
245
+ `dsh.profile.bundles`,重启 `dsh web`。DSH Desktop 用
246
+ `~/.dsh/profiles/desktop` 对应路径。
247
+
250
248
  ## 🙋 常见问题
251
249
 
252
250
  - Q: **_"为什么外观行里看不到 Catppuccin 主题?"_**\
package/cordis.patch.yml CHANGED
@@ -4,3 +4,13 @@
4
4
  - insert:
5
5
  - id: dsh-catppuccin
6
6
  name: '@nonamelego/dsh-catppuccin'
7
+ # TUI theme sync: idempotently copies the four Catppuccin theme JSONs into
8
+ # ~/.dsh-tui/themes/ on activation. No inject, so it activates in EVERY
9
+ # profile — in a dsh-tui profile this is what makes the one-command
10
+ # install work (dsh-TUI reads themes only from that directory; there is
11
+ # no registration API); in a web/desktop profile it keeps themes in sync
12
+ # for users who also run dsh-TUI; with no ~/.dsh-tui on disk it is a
13
+ # strict no-op. The main row above stays pending on webServer there,
14
+ # same benign state as headless profiles.
15
+ - id: dsh-catppuccin-tui-themes
16
+ name: '@nonamelego/dsh-catppuccin/tui-themes'
package/lib/client.js CHANGED
@@ -509,15 +509,15 @@ window.__ModuleLoader__.load({
509
509
  "--dsw-alias-interactive-bg-hover-danger": "rgba(242, 90, 90, 0.15)",
510
510
  "--dsw-alias-interactive-bg-hover-solid": "var(--dsw-static-neutral-bluish-800)",
511
511
  "--dsw-alias-interactive-bg-hover": "rgba(255, 255, 255, 0.08)",
512
- "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-600)",
513
- "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-750)",
512
+ "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-300)",
513
+ "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-400)",
514
514
  "--dsw-alias-label-primary-bluish": "var(--dsw-static-neutral-bluish-50)",
515
- "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-100)",
515
+ "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-75)",
516
516
  "--dsw-alias-label-primary-foreground": "var(--dsw-static-neutral-bluish-1000)",
517
517
  "--dsw-alias-label-primary-inverted": "var(--dsw-static-neutral-bluish-800)",
518
518
  "--dsw-alias-label-primary": "var(--dsw-static-neutral-bluish-50)",
519
- "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-300)",
520
- "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-400)",
519
+ "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-150)",
520
+ "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-200)",
521
521
  "--dsw-alias-markdown-citation": "var(--dsw-static-neutral-bluish-800)",
522
522
  "--dsw-alias-markdown-code-block-banner": "var(--dsw-static-neutral-bluish-850)",
523
523
  "--dsw-alias-markdown-code-block": "var(--dsw-static-neutral-bluish-900)",
@@ -679,15 +679,15 @@ window.__ModuleLoader__.load({
679
679
  "--dsw-alias-interactive-bg-hover-danger": "rgba(242, 90, 90, 0.15)",
680
680
  "--dsw-alias-interactive-bg-hover-solid": "var(--dsw-static-neutral-bluish-800)",
681
681
  "--dsw-alias-interactive-bg-hover": "rgba(255, 255, 255, 0.08)",
682
- "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-600)",
683
- "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-750)",
682
+ "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-300)",
683
+ "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-400)",
684
684
  "--dsw-alias-label-primary-bluish": "var(--dsw-static-neutral-bluish-50)",
685
- "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-100)",
685
+ "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-75)",
686
686
  "--dsw-alias-label-primary-foreground": "var(--dsw-static-neutral-bluish-1000)",
687
687
  "--dsw-alias-label-primary-inverted": "var(--dsw-static-neutral-bluish-800)",
688
688
  "--dsw-alias-label-primary": "var(--dsw-static-neutral-bluish-50)",
689
- "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-300)",
690
- "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-400)",
689
+ "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-150)",
690
+ "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-200)",
691
691
  "--dsw-alias-markdown-citation": "var(--dsw-static-neutral-bluish-800)",
692
692
  "--dsw-alias-markdown-code-block-banner": "var(--dsw-static-neutral-bluish-850)",
693
693
  "--dsw-alias-markdown-code-block": "var(--dsw-static-neutral-bluish-900)",
@@ -849,15 +849,15 @@ window.__ModuleLoader__.load({
849
849
  "--dsw-alias-interactive-bg-hover-danger": "rgba(242, 90, 90, 0.15)",
850
850
  "--dsw-alias-interactive-bg-hover-solid": "var(--dsw-static-neutral-bluish-800)",
851
851
  "--dsw-alias-interactive-bg-hover": "rgba(255, 255, 255, 0.08)",
852
- "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-600)",
853
- "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-750)",
852
+ "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-300)",
853
+ "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-400)",
854
854
  "--dsw-alias-label-primary-bluish": "var(--dsw-static-neutral-bluish-50)",
855
- "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-100)",
855
+ "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-75)",
856
856
  "--dsw-alias-label-primary-foreground": "var(--dsw-static-neutral-bluish-1000)",
857
857
  "--dsw-alias-label-primary-inverted": "var(--dsw-static-neutral-bluish-800)",
858
858
  "--dsw-alias-label-primary": "var(--dsw-static-neutral-bluish-50)",
859
- "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-300)",
860
- "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-400)",
859
+ "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-150)",
860
+ "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-200)",
861
861
  "--dsw-alias-markdown-citation": "var(--dsw-static-neutral-bluish-800)",
862
862
  "--dsw-alias-markdown-code-block-banner": "var(--dsw-static-neutral-bluish-850)",
863
863
  "--dsw-alias-markdown-code-block": "var(--dsw-static-neutral-bluish-900)",
@@ -2063,6 +2063,29 @@ window.__ModuleLoader__.load({
2063
2063
  return "system";
2064
2064
  }
2065
2065
  }
2066
+ /** Built-in preferences the Appearance row can explicitly pick. */
2067
+ const BUILTIN_PREFERENCES = [
2068
+ "light",
2069
+ "dark",
2070
+ "system"
2071
+ ];
2072
+ function isBuiltinPreference(value) {
2073
+ return BUILTIN_PREFERENCES.includes(value);
2074
+ }
2075
+ /** Whether an observed built-in preference wins over the persisted flavour.
2076
+ * Only a light/dark value the user explicitly picked in THIS session — the
2077
+ * recorded `liveBuiltinPick` from the setTheme wrapper — wins. Values adopted
2078
+ * from the settings document at boot/reload (`livePick` null) never win
2079
+ * (issue #6: a doc persisted as `ui-theme.preference: light` was mistaken for
2080
+ * a user choice and buried the flavour on every refresh/restart), and
2081
+ * "system" never wins: while a flavour is on, the Catppuccin row is the
2082
+ * active controller and the Appearance row must not bury the persisted
2083
+ * choice. A user's explicit light/dark pick still wins immediately (matching
2084
+ * livePick) and choosing "off" in the Catppuccin row restores it. */
2085
+ function builtinPickWins(preference, livePick) {
2086
+ if (preference !== "light" && preference !== "dark") return false;
2087
+ return preference === livePick;
2088
+ }
2066
2089
  /** Required services: slots + locale (settings rows) and theme (register + switch). */
2067
2090
  const inject = [
2068
2091
  "slots",
@@ -2104,13 +2127,19 @@ window.__ModuleLoader__.load({
2104
2127
  glass: glass.getRemoteState()
2105
2128
  });
2106
2129
  ctx.effect(() => {
2130
+ let liveBuiltinPick = null;
2131
+ const originalSetTheme = theme.setTheme;
2132
+ theme.setTheme = (id) => {
2133
+ liveBuiltinPick = isBuiltinPreference(id) ? id : null;
2134
+ originalSetTheme.call(theme, id);
2135
+ };
2107
2136
  const applyDesired = () => {
2108
2137
  rememberBuiltinPreference(theme.getTheme().preference);
2109
2138
  const desired = readFlavor();
2110
2139
  if (desired === "off") return;
2111
2140
  const preference = theme.getTheme().preference;
2112
2141
  if (preference === desired) return;
2113
- if (preference !== "system") return;
2142
+ if (builtinPickWins(preference, liveBuiltinPick)) return;
2114
2143
  try {
2115
2144
  theme.setTheme(desired);
2116
2145
  } catch {}
@@ -2146,6 +2175,7 @@ window.__ModuleLoader__.load({
2146
2175
  disposer();
2147
2176
  window.removeEventListener("storage", onStorage);
2148
2177
  cancelDurablePersist();
2178
+ theme.setTheme = originalSetTheme;
2149
2179
  };
2150
2180
  }, "catppuccin: theme restore");
2151
2181
  const injected = () => ({
@@ -2234,6 +2264,7 @@ window.__ModuleLoader__.load({
2234
2264
  exports.NS = NS;
2235
2265
  exports.RESTORE_STORAGE_KEY = RESTORE_STORAGE_KEY;
2236
2266
  exports.apply = apply;
2267
+ exports.builtinPickWins = builtinPickWins;
2237
2268
  exports.flavorFromThemeId = flavorFromThemeId;
2238
2269
  exports.flavorInfo = flavorInfo;
2239
2270
  exports.inject = inject;