dsh-any-background 0.1.6 → 0.1.8

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Tkingxiao
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tkingxiao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,274 +1,129 @@
1
- # dsh-any-background
2
-
3
- <a href="https://github.com/Tkingxiao/dsh-any-background" target="_blank">
4
- <img src="https://img.shields.io/github/stars/Tkingxiao/dsh-any-background?style=social" alt="GitHub stars" />
5
- </a>
6
-
7
- English | [中文](README.zh.md)
8
-
9
- A **DeepSeek Harness** appearance plugin that lets you fully customize the Web UI with a custom theme color, background wallpaper, and fine-grained opacity controls.
10
-
11
- ---
12
-
13
- ## Features
14
-
15
- - **PS-style Color Wheel** — Pick hue on the ring, adjust saturation & lightness in the inscribed square. Generates a full set of 30+ CSS design tokens in real time and applies them instantly.
16
- - **Background Wallpaper** — Choose any image as your wallpaper. Drag to pan, scroll to zoom inside a viewport-proportional editor. What you see is what you get.
17
- - **Opacity Controls** — Separate sliders for main interface background opacity, settings panel opacity, and wallpaper opacity.
18
- - **Blur Effect** — Adjustable wallpaper blur (0–60 px) for a frosted-glass look.
19
- - **Persistent** — All settings (color, wallpaper, opacity, blur, editor position) are stored on the **filesystem** under `~/.dsh/.dsh-any-background-data/` via the node half, and restored on next launch. No more `localStorage` quota worries.
20
- - **Bilingual** — Full Chinese / English UI with automatic locale detection.
21
- - **Theme Watchdog** — A background watchdog re-asserts the custom theme if the host resets it, so your pick never silently disappears.
22
-
23
- ## Project Structure
24
-
25
- ```
26
- dsh-any-background/
27
- ├── package.json # Package metadata, dsh.client declaration, dependencies
28
- ├── cordis.patch.yml # Bundle patch layer (inserted into profile composition)
29
- ├── cordis.yml # Patch overlay for dev usage (pnpm dsh web --patch)
30
- ├── tsdown.config.ts # Build config: node-half (ESM) + client-half (CJS browser bundle)
31
- ├── src/
32
- │ ├── index.ts # Node half — file-backed persistence (RPC file store)
33
- │ ├── invariant.ts # Invariant companion (registers package ownership)
34
- │ └── client/
35
- │ └── index.tsx # Browser half — ALL UI logic lives here
36
- ├── lib/ # Built output, committed so installs need no build step
37
- │ ├── index.js # Node entry
38
- │ ├── invariant.js # Invariant entry
39
- │ ├── client.js # Browser bundle (wrapped for __ModuleLoader__)
40
- │ └── client.js.map # Source map
41
- ├── example_img/ # Example screenshots
42
- ├── README.md # This file (English)
43
- └── README.zh.md # 中文版
44
- ```
45
-
46
- ## Implementation
47
-
48
- The plugin is a Cordis plugin split into two halves:
49
-
50
- - **Node half** (`src/index.ts`) — owns file-backed persistence. It manages the `.dsh-any-background-data/` store under the DSH data home (`~/.dsh/`) and exposes a small RPC surface over the shared `/api` channel.
51
- - **Browser half** (`src/client/index.tsx`) — all UI logic lives here. The browser cannot touch the filesystem, so it reads/writes the store through the node half's RPC endpoints.
52
-
53
- ### Persistence
54
-
55
- Since the plugin surfaces in the browser, persisted data is stored on disk by the **node half**:
56
-
57
- ```
58
- ~/.dsh/.dsh-any-background-data/
59
- ├── theme-config.json # color, main/settings/wallpaper opacity, blur, bg edit state
60
- └── wallpaper.jpg # the chosen background image (deleted when removed)
61
- ```
62
-
63
- - On startup the client calls `read`, which returns the config and (if present) the wallpaper as a data URL.
64
- - Every setting change is written back synchronously to `theme-config.json`; changing the wallpaper writes `wallpaper.jpg`, removing it deletes the file.
65
- - The store is created automatically if missing; a missing or malformed config falls back to defaults (with a warning), and all writes are error-guarded to avoid data loss.
66
-
67
- ### Architecture
68
-
69
- ```
70
- ┌─────────────────────────────────────────────────────────┐
71
- │ apply(ctx) — Plugin entry point │
72
- ├─────────────────────────────────────────────────────────┤
73
- │ │
74
- │ 1. Restore saved color → registerCustom() → setTheme │
75
- │ 2. Inject gradient <style> into <head> │
76
- │ 3. Create state store (defineStore) │
77
- │ 4. applyWp() → wallpaper + token overrides │
78
- │ 5. Listen theme/change → re-apply │
79
- │ 6. ResizeObserver → viewport-aware re-positioning │
80
- │ 7. Locale registration (zh/en) │
81
- │ 8. Settings section injection (ThemeSection) │
82
- │ 9. Deferred boot restore (300ms, 1500ms) │
83
- │ 10. Theme watchdog (1s interval) │
84
- │ │
85
- └─────────────────────────────────────────────────────────┘
86
- ```
87
-
88
- ### Color Wheel
89
-
90
- - Single `<canvas>` element: hue ring (360° segments) + inscribed SL square (HSV S-V plane).
91
- - `hitTest()` determines whether a click lands on the ring (hue) or square (saturation/lightness).
92
- - HSV values from the canvas are converted to HSL via `hsvToHsl()` before passing to `genTokens()`.
93
- - `genTokens()` generates 30+ CSS custom properties (`--dsw-alias-*`) for the picked color, choosing dark or light scheme based on lightness.
94
- - The full token set is written as inline styles on `<body>`, so the theme color never depends on the theme service's timing.
95
-
96
- #### Theme Color Adjustment
97
-
98
- <p align="center">
99
- <img src="example_img/image.png" alt="Blue theme" width="600">
100
- <br/>
101
- <em>Blue theme · Light · Default dark font</em>
102
- </p>
103
-
104
- <p align="center">
105
- <img src="example_img/image-1.png" alt="Pink theme" width="600">
106
- <br/>
107
- <em>Pink theme · Dark · Default light font</em>
108
- </p>
109
-
110
- ### Background Wallpaper
111
-
112
- - A `<div>` with `position:fixed; z-index:-1` is prepended to `<body>`.
113
- - Image is compressed via Canvas API (max 1600px side, JPEG quality 0.75); the node half writes it to `~/.dsh/.dsh-any-background-data/wallpaper.jpg`, and the client keeps the data URL in memory for display.
114
- - The editor modal shows a viewport-proportional rectangle; drag to pan, scroll to zoom (0.1×–10×).
115
- - Committed position is stored as fractional center coordinates + natural image size, so the layout survives viewport changes.
116
- - Wallpaper opacity is applied directly to the `<div>` element; background color opacity is applied via inline token overrides.
117
-
118
- #### Wallpaper Preview
119
-
120
- <p align="center">
121
- <img src="example_img/image-2.png" alt="Wallpaper opacity and blur adjustment" width="600">
122
- <br/>
123
- <em>Wallpaper opacity and blur adjustment</em>
124
- </p>
125
-
126
- #### Editor Adjustment
127
-
128
- <p align="center">
129
- <img src="example_img/image-3.png" alt="Editor adjustment" width="400">
130
- <img src="example_img/image-4.png" alt="Background mapping" width="400">
131
- <br/>
132
- <em>Editor adjustment · Background mapping</em>
133
- </p>
134
-
135
- ### Opacity System
136
-
137
- Three independent opacity layers, each with its own slider and a persisted config field:
138
-
139
- | Layer | Config field | Default | Mechanism |
140
- |-------|--------------|---------|-----------|
141
- | Main interface | `opacity` | 85% | Inline CSS variable on `<body>` |
142
- | Settings panel | `settingsOpacity` | 100% | CSS variable on `<html>` via `[aria-modal]` selector |
143
- | Wallpaper | `wallpaperOpacity` | 100% | Direct `style.opacity` on wallpaper `<div>` |
144
-
145
- #### Settings Opacity
146
-
147
- <p align="center">
148
- <img src="example_img/image-5.png" alt="Settings opacity 100%" width="400">
149
- <img src="example_img/image-6.png" alt="Settings opacity 49%" width="400">
150
- <br/>
151
- <em>Settings opacity 100% · Settings opacity 49%</em>
152
- </p>
153
-
154
- #### Main Interface Opacity
155
-
156
- <p align="center">
157
- <img src="example_img/image-6.png" alt="Main interface opacity 100%" width="400">
158
- <img src="example_img/image-7.png" alt="Main interface opacity 0%" width="400">
159
- <br/>
160
- <em>Main interface opacity 100% · Main interface opacity 0%</em>
161
- </p>
162
-
163
- #### Wallpaper Opacity
164
-
165
- <p align="center">
166
- <img src="example_img/image-8.png" alt="Wallpaper opacity 100%" width="400">
167
- <img src="example_img/image-9.png" alt="Wallpaper opacity 50%" width="400">
168
- <br/>
169
- <em>Wallpaper opacity 0% · Wallpaper opacity 100%</em>
170
- </p>
171
-
172
- #### Wallpaper Blur
173
-
174
- <p align="center">
175
- <img src="example_img/image-10.png" alt="Wallpaper blur 50%" width="400">
176
- <img src="example_img/image-11.png" alt="Wallpaper blur 0%" width="400">
177
- <br/>
178
- <em>Wallpaper blur 50% · Wallpaper blur 0%</em>
179
- </p>
180
-
181
- ## Installation
182
-
183
- ### Method 1: npm install (Recommended)
184
-
185
- Install the plugin directly from GitHub into your Web profile:
186
-
187
- ```sh
188
- dsh plugin --profile web add github:Tkingxiao/dsh-any-background
189
- ```
190
- ```sh
191
- dsh plugin --profile web add dsh-any-background
192
- ```
193
- Then launch the Web UI:
194
-
195
- ```sh
196
- dsh web
197
- ```
198
-
199
- The plugin will appear as a **"Theme"** section in the Settings panel.
200
-
201
- ### Method 2: npx (No Global Install)
202
-
203
- If you don't have `dsh` installed globally, use `npx`:
204
-
205
- ```sh
206
- npx @deepseek-ai/dsh plugin --profile web add github:Tkingxiao/dsh-any-background
207
- ```
208
- ```sh
209
- npx @deepseek-ai/dsh plugin --profile web add dsh-any-background
210
- ```
211
-
212
- Then launch:
213
-
214
- ```sh
215
- npx @deepseek-ai/dsh web
216
- ```
217
-
218
- ### Method 3: Local Build (Development)
219
-
220
- The `lib/` directory is committed, so installs need no build step. To rebuild after
221
- editing `src/`, run the bundle script (needs Node + pnpm):
222
-
223
- ```sh
224
- # 1. Clone this repo
225
- git clone https://github.com/Tkingxiao/dsh-any-background.git
226
- cd dsh-any-background
227
-
228
- # 2. Install the build tool (also pulls the @deepseek-ai/dsh-home-paths runtime dep)
229
- pnpm install
230
-
231
- # 3. Rebuild lib/
232
- pnpm run bundle
233
-
234
- # 4. Install the plugin into the web profile from the local checkout
235
- # (`dsh plugin add` wraps `pnpm add <dir>`, so point it at this directory)
236
- cd .
237
- pnpm dsh plugin --profile web add “dsh-any-background”
238
-
239
- # 5. Launch
240
- pnpm dsh web
241
- ```
242
-
243
- ## Compatibility
244
-
245
- The plugin works on both the **Web UI** and the **desktop client**:
246
-
247
- - **[`dsh web`](https://github.com/deepseek-ai/deepseek-harness)** — Web profile, full support.
248
- - **[deepseek-harness-desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** — supported, but there is a known Electron packaging issue: the **left sidebar and the center area opacity are inverted** (the sidebar looks more transparent than the center and vice versa). This is a client-side packaging bug, not a plugin bug — we are waiting for the desktop client to be updated to fix it.
249
-
250
- ## Dependencies
251
-
252
- | Package | Purpose |
253
- |---------|---------|
254
- | `@deepseek-ai/cordis` | Plugin framework (Cordis) |
255
- | `@deepseek-ai/dsh-home-paths` | Resolve the DSH data home for the persistence store |
256
- | `@deepseek-ai/dsh-client-runtime` | Client runtime + `defineStore` |
257
- | `@deepseek-ai/dsh-client-locale` | i18n (Chinese/English) |
258
- | `@deepseek-ai/dsh-client-ui-theme` | Theme service (register/setTheme/overrideTokens) |
259
- | `@deepseek-ai/dsh-invariants` | Package invariant companion |
260
- | `react` ^18.2.0 | UI rendering |
261
-
262
- ## Star History
263
-
264
- <a href="https://www.star-history.com/?repos=Tkingxiao%2Fdsh-any-background&type=timeline&legend=bottom-right">
265
- <picture>
266
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=Tkingxiao/dsh-any-background&type=timeline&theme=dark&legend=bottom-right&sealed_token=eWfGjN-Qq27TMTaT_VVvuRZMI72MUHAVfaHws-WOwQE7ld9defq7Bn7Xsgmlg-7iFSCeNoOIhgxFfZM3jazeXnLzldBkMCN3jm4CMxvn6Em0EBEZWWK5pA" />
267
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=Tkingxiao/dsh-any-background&type=timeline&legend=bottom-right&sealed_token=eWfGjN-Qq27TMTaT_VVvuRZMI72MUHAVfaHws-WOwQE7ld9defq7Bn7Xsgmlg-7iFSCeNoOIhgxFfZM3jazeXnLzldBkMCN3jm4CMxvn6Em0EBEZWWK5pA" />
268
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=Tkingxiao/dsh-any-background&type=timeline&legend=bottom-right&sealed_token=eWfGjN-Qq27TMTaT_VVvuRZMI72MUHAVfaHws-WOwQE7ld9defq7Bn7Xsgmlg-7iFSCeNoOIhgxFfZM3jazeXnLzldBkMCN3jm4CMxvn6Em0EBEZWWK5pA" />
269
- </picture>
270
- </a>
271
-
272
- ## License
273
-
274
- MIT
1
+ # dsh-any-background
2
+
3
+ <a href="https://github.com/Tkingxiao/dsh-any-background" target="_blank">
4
+ <img src="https://img.shields.io/github/stars/Tkingxiao/dsh-any-background?style=social" alt="GitHub stars" />
5
+ </a>
6
+
7
+ English | [中文](README.zh.md)
8
+
9
+ A **DeepSeek Harness** appearance plugin that lets you fully customize the Web UI — custom theme color, background wallpaper, and fine-grained per-part opacity & blur controls.
10
+
11
+ ---
12
+
13
+ ## Screenshots
14
+
15
+ <p align="center">
16
+ <img src="example_img/image.png" alt="Custom homepage" width="720">
17
+ <br/>
18
+ <em>Custom homepage · wallpaper + theme color applied</em>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <img src="example_img/image-2.png" alt="Theme color picker" width="720">
23
+ <br/>
24
+ <em>Theme color picker · PS-style wheel + precise HSL/RGB inputs</em>
25
+ </p>
26
+
27
+ <p align="center">
28
+ <img src="example_img/image-3.png" alt="Per-part opacity and blur" width="720">
29
+ <br/>
30
+ <em>Per-part opacity and blur · main background, sidebar, cards, settings</em>
31
+ </p>
32
+
33
+ <p align="center">
34
+ <img src="example_img/image-4.png" alt="Background editor" width="720">
35
+ <br/>
36
+ <em>Background editor · image wallpapers support drag-to-pan and scroll-to-zoom</em>
37
+ </p>
38
+
39
+ <p align="center">
40
+ <img src="example_img/image-6.png" alt="Generated dynamic background" width="720">
41
+ <br/>
42
+ <em>Generated dynamic background · mesh gradient / Shader / geometric presets</em>
43
+ </p>
44
+
45
+ <p align="center">
46
+ <img src="example_img/image-9.png" alt="Geometric background, low-poly mode" width="720">
47
+ <br/>
48
+ <em>Generated dynamic background · geometric low-poly mode preview</em>
49
+ </p>
50
+
51
+ <p align="center">
52
+ <img src="example_img/image-10.png" alt="Config export and import" width="720">
53
+ <br/>
54
+ <em>Export and import configs to share</em>
55
+ </p>
56
+
57
+ ## Features
58
+
59
+ - **PS-style Color Wheel** — Pick hue on the ring, adjust saturation & lightness in the inscribed square. Generates 30+ CSS design tokens in real time.
60
+ - **Precise HSL / RGB Input** — Enter exact color values numerically with instant bidirectional sync to the wheel.
61
+ - **Smart Color Extraction** — One click derives a theme color from your wallpaper by sampling the visible region, quantizing, and filtering out gray / near-black / near-white pixels. Fully client-side.
62
+ - **Eyedropper** — Hover the wallpaper to preview a color and click to pick it as the theme color.
63
+ - **Background Wallpaper** — Upload any image as your wallpaper. Drag to pan and scroll to zoom inside a viewport-proportional editor.
64
+ - **Generated Dynamic Backgrounds** — Choose mesh gradient, Shader, or geometric patterns with adjustable spread, intensity, and seed locking.
65
+ - **Per-part Interface Opacity** — Independent sliders for main background, sidebar, cards & panels, plus the settings panel and wallpaper.
66
+ - **Per-part Interface Blur** — Frosted-glass `backdrop-filter` blur (0–60 px) for each interface part.
67
+ - **Theme Export / Import** — One-click export to a self-contained `dsh-any-theme.json` (config + wallpaper) and import to restore it anywhere.
68
+ - **File-based Persistence** — All settings are stored on the filesystem under `~/.dsh/.dsh-any-background-data/`, not `localStorage`.
69
+ - **Bilingual** — Full Chinese / English UI with automatic locale detection.
70
+ - **Theme Watchdog** — Re-asserts the custom theme if the host resets it.
71
+
72
+ ## Recent Optimizations
73
+
74
+ - **Boot flicker eliminated** — Theme tokens are injected through a dedicated `!important` stylesheet instead of inline `body` styles, surviving host theme service resets.
75
+ - **Color wheel overlap fixed** — The hue ring is drawn on top of the saturation/lightness square so the square corners no longer cover the ring.
76
+ - **Inspiration palette selection cleared** — Picking a theme color from the wheel deselects any previously selected inspiration swatch.
77
+ - **Debug telemetry removed** — Temporary boot-time logging and `MutationObserver` instrumentation have been cleaned out.
78
+ - **Per-part blur isolated** — Blur is applied on `::before` underlays so it never traps the host's fixed-position settings dialog.
79
+
80
+ ## Installation
81
+
82
+ ### Method 1: npm install (Recommended)
83
+
84
+ ```sh
85
+ dsh plugin --profile web add github:Tkingxiao/dsh-any-background
86
+ # or, if published to the registry:
87
+ dsh plugin --profile web add dsh-any-background
88
+ ```
89
+
90
+ Then launch:
91
+
92
+ ```sh
93
+ dsh web
94
+ ```
95
+
96
+ The plugin appears as a **"Theme"** section in Settings.
97
+
98
+ ### Method 2: npx (No Global Install)
99
+
100
+ ```sh
101
+ npx @deepseek-ai/dsh plugin --profile web add github:Tkingxiao/dsh-any-background
102
+ npx @deepseek-ai/dsh web
103
+ ```
104
+
105
+ ### Method 3: Local Build (Development)
106
+
107
+ The `lib/` directory is committed, so installs need no build step. To rebuild after editing `src/`:
108
+
109
+ ```sh
110
+ git clone https://github.com/Tkingxiao/dsh-any-background.git
111
+ cd dsh-any-background
112
+ pnpm install
113
+ pnpm run bundle
114
+ pnpm dsh plugin --profile web add "dsh-any-background"
115
+ pnpm dsh web
116
+ ```
117
+
118
+ ## Compatibility
119
+
120
+ - **[`dsh web`](https://github.com/deepseek-ai/deepseek-harness)** — Full support.
121
+ - **[deepseek-harness-desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** — Supported; a known Electron packaging issue makes the left sidebar and center area opacity appear inverted — awaiting a desktop-client update to fix it.
122
+
123
+ ## Star History
124
+
125
+ [![Star History Chart](https://api.star-history.com/chart?repos=Tkingxiao/dsh-any-background&type=timeline&legend=bottom-right&sealed_token=f5MhnHibC049CC0Ed_nZX8rYpIq2wPTdTXUsPPafAiYxYKOeqyKyMFirxKppeLNJygxv1iw2BlsnCYOWgu9zN6ffr7kJlAG1SlRoQRmQivCIkPzZ2lhSBQ)](https://www.star-history.com/?repos=Tkingxiao%2Fdsh-any-background&type=timeline&legend=bottom-right)
126
+
127
+ ## License
128
+
129
+ MIT