dsh-any-background 0.1.7 → 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
@@ -10,284 +10,115 @@ A **DeepSeek Harness** appearance plugin that lets you fully customize the Web U
10
10
 
11
11
  ---
12
12
 
13
- ## Features
14
-
15
- - **PS-style Color Wheel** — Pick hue on the ring, adjust saturation & lightness in the inscribed square. Generates 30+ CSS design tokens in real time and applies them instantly.
16
- - **Precise HSL / RGB Input** — Enter exact color values numerically (HSL or RGB tabs) with instant bidirectional sync to the wheel.
17
- - **Smart Color Extraction** — One click derives a theme color from your wallpaper: the framed (visible) region is sampled, quantized, filtered of gray/near-black/near-white pixels, and the most dominant vivid hue becomes the theme color. Runs fully client-side with a 64×64 sample — no RPC traffic.
18
- - **Eyedropper** — Hover the wallpaper to preview a color and click to pick it as the theme color.
19
- - **Background Wallpaper** — Choose any image as your wallpaper. Drag to pan, scroll to zoom (anchored at the view center) inside a viewport-proportional editor. What you see is what you get.
20
- - **Per-part Interface Opacity** — Independent sliders for main background, sidebar, cards & panels, plus the settings panel and wallpaper.
21
- - **Per-part Interface Blur** — Frosted-glass `backdrop-filter` blur (0–60 px) for each interface part, independently adjustable.
22
- - **Theme Export / Import** — One-click export to a self-contained `dsh-any-theme.json` (config + wallpaper) and import to restore it anywhere.
23
- - **File-based Persistence** — All settings (color, opacities, blurs, wallpaper, 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.
24
- - **Bilingual** — Full Chinese / English UI with automatic locale detection.
25
- - **Theme Watchdog** — A background watchdog re-asserts the custom theme if the host resets it, so your pick never silently disappears.
26
-
27
- ## Project Structure
28
-
29
- ```
30
- dsh-any-background/
31
- ├── package.json # Package metadata, dsh.client declaration, dependencies
32
- ├── cordis.patch.yml # Bundle patch layer (inserted into profile composition)
33
- ├── cordis.yml # Patch overlay for dev usage (pnpm dsh web --patch)
34
- ├── tsdown.config.ts # Build config: node-half (ESM) + client-half (CJS browser bundle)
35
- ├── src/
36
- │ ├── index.ts # Node half — file-backed persistence (RPC file store)
37
- │ ├── invariant.ts # Invariant companion (registers package ownership)
38
- │ └── client/ # Browser half — modularized by concern
39
- │ ├── index.tsx # Lifecycle wiring (theme, wallpaper, i18n, section, watchdog)
40
- │ ├── types.ts # Shared type definitions
41
- │ ├── state.ts # In-memory config mirror + getters
42
- │ ├── rpc.ts # File-backed persistence RPC client
43
- │ ├── wallpaper.ts # Wallpaper DOM layer + per-part opacity/blur application
44
- │ ├── i18n.ts # zh/en dictionaries
45
- │ ├── styles.ts # Shared inline styles
46
- │ ├── utils/
47
- │ │ ├── color.ts # Color math, token generation, wallpaper color extraction
48
- │ │ └── image.ts # Wallpaper file reading (as-is data URL)
49
- │ └── components/
50
- │ ├── ThemeSection.tsx # Settings panel section (all controls)
51
- │ ├── ColorWheel.tsx # Hue ring + SL square canvas
52
- │ ├── ColorInputs.tsx # Precise HSL/RGB entry
53
- │ ├── ColorPicker.tsx # Eyedropper modal
54
- │ ├── BgEditor.tsx # Wallpaper position/size editor
55
- │ ├── LiveSlider.tsx # Throttled live slider
56
- │ ├── ErrorBoundary.tsx # Crash fallback for the panel
57
- │ └── icons.tsx # Migrated nav glyphs (sun icon)
58
- ├── lib/ # Built output, committed so installs need no build step
59
- │ ├── index.js # Node entry
60
- │ ├── invariant.js # Invariant entry
61
- │ ├── client.js # Browser bundle (wrapped for __ModuleLoader__)
62
- │ └── client.js.map # Source map
63
- ├── example_img/ # Example screenshots
64
- ├── README.md # This file (English)
65
- └── README.zh.md # 中文版
66
- ```
67
-
68
- ## Implementation
69
-
70
- The plugin is a Cordis plugin split into two halves:
71
-
72
- - **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 dedicated `/dsh-any-background` channel.
73
- - **Browser half** (`src/client/`) — all UI logic lives here. The browser cannot touch the filesystem, so it reads/writes the store through the node half's RPC endpoints.
74
-
75
- ### Persistence
76
-
77
- Since the plugin surfaces in the browser, persisted data is stored on disk by the **node half**:
78
-
79
- ```
80
- ~/.dsh/.dsh-any-background-data/
81
- ├── theme-config.json # color, per-part opacities & blurs, settings/wallpaper opacity, blur, bg edit state
82
- └── wallpaper.jpg # the chosen background image (deleted when removed)
83
- ```
84
-
85
- - On startup the client calls `read`, which returns the config and (if present) the wallpaper as a data URL.
86
- - Every setting change is written back synchronously to `theme-config.json`; changing the wallpaper writes `wallpaper.jpg`, removing it deletes the file.
87
- - 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.
88
- - Older configs (single `opacity` field, no per-part fields) migrate automatically to the per-part structure on load.
89
-
90
- ### Architecture
91
-
92
- ```
93
- ┌─────────────────────────────────────────────────────────┐
94
- │ apply(ctx) — Plugin entry point │
95
- ├─────────────────────────────────────────────────────────┤
96
- │ │
97
- │ 1. Restore saved color → registerCustom() → setTheme │
98
- │ 2. Inject gradient <style> into <head> │
99
- │ 3. Create state store (defineStore) │
100
- │ 4. applyWp() → wallpaper + per-part opacity/blur │
101
- │ 5. Listen theme/change → re-apply │
102
- │ 6. ResizeObserver → viewport-aware re-positioning │
103
- │ 7. Locale registration (zh/en) │
104
- │ 8. Settings section injection (ThemeSection) │
105
- │ 9. Settings-nav icon patch (sun glyph) │
106
- │ 10. Deferred boot restore (300ms, 1500ms) │
107
- │ 11. Theme watchdog (1s interval) │
108
- │ │
109
- └─────────────────────────────────────────────────────────┘
110
- ```
111
-
112
- ### Color Wheel
113
-
114
- - Single `<canvas>` element: hue ring (360° segments) + inscribed SL square (HSV S-V plane).
115
- - `hitTest()` determines whether a click lands on the ring (hue) or square (saturation/lightness).
116
- - HSV values from the canvas are converted to HSL via `hsvToHsl()` before passing to `genTokens()`.
117
- - `genTokens()` generates 30+ CSS custom properties (`--dsw-alias-*`) for the picked color, choosing dark or light scheme based on lightness.
118
- - The full token set is written as inline styles on `<body>`, so the theme color never depends on the theme service's timing.
119
- - A **precise input panel** (HSL / RGB tabs) sits next to the wheel — numeric entry syncs both ways with the canvas in real time.
120
-
121
- #### Theme Color Adjustment
13
+ ## Screenshots
122
14
 
123
15
  <p align="center">
124
- <img src="example_img/image.png" alt="Blue theme" width="600">
16
+ <img src="example_img/image.png" alt="Custom homepage" width="720">
125
17
  <br/>
126
- <em>Blue theme · Light · Default dark font</em>
18
+ <em>Custom homepage · wallpaper + theme color applied</em>
127
19
  </p>
128
20
 
129
21
  <p align="center">
130
- <img src="example_img/image-1.png" alt="Pink theme" width="600">
22
+ <img src="example_img/image-2.png" alt="Theme color picker" width="720">
131
23
  <br/>
132
- <em>Pink theme · Dark · Default light font</em>
24
+ <em>Theme color picker · PS-style wheel + precise HSL/RGB inputs</em>
133
25
  </p>
134
26
 
135
- ### Background Wallpaper
136
-
137
- - A `<div>` with `position:fixed; z-index:-1` is prepended to `<body>`.
138
- - The chosen image is stored **as-is** (original data URL, no re-encoding), so the wallpaper keeps full fidelity; the node half writes it to `~/.dsh/.dsh-any-background-data/wallpaper.jpg`, and the client keeps the data URL in memory for display.
139
- - The editor modal shows a viewport-proportional rectangle; drag to pan, scroll to zoom (0.1×–10×) anchored at the view center.
140
- - Committed position is stored as fractional center coordinates + natural image size, so the layout survives viewport changes.
141
- - Wallpaper opacity is applied directly to the `<div>` element; wallpaper blur via `filter: blur()`.
142
-
143
- #### Wallpaper Preview
144
-
145
27
  <p align="center">
146
- <img src="example_img/image-2.png" alt="Wallpaper opacity and blur adjustment" width="600">
28
+ <img src="example_img/image-3.png" alt="Per-part opacity and blur" width="720">
147
29
  <br/>
148
- <em>Wallpaper opacity and blur adjustment</em>
30
+ <em>Per-part opacity and blur · main background, sidebar, cards, settings</em>
149
31
  </p>
150
32
 
151
- #### Editor Adjustment
152
-
153
33
  <p align="center">
154
- <img src="example_img/image-3.png" alt="Editor adjustment" width="400">
155
- <img src="example_img/image-4.png" alt="Background mapping" width="400">
34
+ <img src="example_img/image-4.png" alt="Background editor" width="720">
156
35
  <br/>
157
- <em>Editor adjustment · Background mapping</em>
36
+ <em>Background editor · image wallpapers support drag-to-pan and scroll-to-zoom</em>
158
37
  </p>
159
38
 
160
- ### Interface Opacity & Blur
161
-
162
- Each interface part has its own **opacity** and **blur** slider. Opacity is applied by re-emitting the theme's surface tokens at the part's alpha; blur is applied via `backdrop-filter: blur()` on the AppFrame columns (the settings panel via a CSS variable).
163
-
164
- | Part | Opacity field | Blur field | Default opacity | Mechanism |
165
- |------|---------------|------------|-----------------|-----------|
166
- | Main background | `opacities.bg` | `blurs.bg` | 85% | Inline token override on `<body>` |
167
- | Sidebar | `opacities.sidebar` | `blurs.sidebar` | 93% | Inline token override on `<body>` |
168
- | Cards & panels | `opacities.card` | `blurs.card` | 100% | Inline token override on `<body>` |
169
- | Settings panel | `settingsOpacity` | `blurs.settings` | 100% | CSS variable via `[aria-modal]` selector |
170
- | Wallpaper | `wallpaperOpacity` | — | 100% | `style.opacity` on the wallpaper `<div>` |
171
-
172
- #### Settings Opacity
173
-
174
39
  <p align="center">
175
- <img src="example_img/image-5.png" alt="Settings opacity 100%" width="400">
176
- <img src="example_img/image-6.png" alt="Settings opacity 49%" width="400">
40
+ <img src="example_img/image-6.png" alt="Generated dynamic background" width="720">
177
41
  <br/>
178
- <em>Settings opacity 100% · Settings opacity 49%</em>
42
+ <em>Generated dynamic background · mesh gradient / Shader / geometric presets</em>
179
43
  </p>
180
44
 
181
- #### Main Interface Opacity
182
-
183
45
  <p align="center">
184
- <img src="example_img/image-6.png" alt="Main interface opacity 100%" width="400">
185
- <img src="example_img/image-7.png" alt="Main interface opacity 0%" width="400">
46
+ <img src="example_img/image-9.png" alt="Geometric background, low-poly mode" width="720">
186
47
  <br/>
187
- <em>Main interface opacity 100% · Main interface opacity 0%</em>
48
+ <em>Generated dynamic background · geometric low-poly mode preview</em>
188
49
  </p>
189
50
 
190
- #### Wallpaper Opacity
191
-
192
51
  <p align="center">
193
- <img src="example_img/image-8.png" alt="Wallpaper opacity 100%" width="400">
194
- <img src="example_img/image-9.png" alt="Wallpaper opacity 50%" width="400">
52
+ <img src="example_img/image-10.png" alt="Config export and import" width="720">
195
53
  <br/>
196
- <em>Wallpaper opacity 0% · Wallpaper opacity 100%</em>
54
+ <em>Export and import configs to share</em>
197
55
  </p>
198
56
 
199
- #### Wallpaper Blur
57
+ ## Features
200
58
 
201
- <p align="center">
202
- <img src="example_img/image-10.png" alt="Wallpaper blur 50%" width="400">
203
- <img src="example_img/image-11.png" alt="Wallpaper blur 0%" width="400">
204
- <br/>
205
- <em>Wallpaper blur 50% · Wallpaper blur 0%</em>
206
- </p>
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.
207
71
 
208
- ### Theme Export / Import
72
+ ## Recent Optimizations
209
73
 
210
- - **Export** — Downloads a self-contained `dsh-any-theme.json`: the full config (color, per-part opacities & blurs, wallpaper settings) plus the wallpaper as its original data URL, so the file is portable on its own.
211
- - **Import** — Applies the config and wallpaper from a theme file, then persists both through the normal paths (config → `theme-config.json`, wallpaper → `wallpaper.jpg`). Old-format files without the newer fields migrate to defaults automatically.
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.
212
79
 
213
80
  ## Installation
214
81
 
215
82
  ### Method 1: npm install (Recommended)
216
83
 
217
- Install the plugin directly from GitHub into your Web profile:
218
-
219
84
  ```sh
220
85
  dsh plugin --profile web add github:Tkingxiao/dsh-any-background
221
- # or, if already published to the registry:
86
+ # or, if published to the registry:
222
87
  dsh plugin --profile web add dsh-any-background
223
88
  ```
224
89
 
225
- Then launch the Web UI:
90
+ Then launch:
226
91
 
227
92
  ```sh
228
93
  dsh web
229
94
  ```
230
95
 
231
- The plugin will appear as a **"Theme"** section in the Settings panel.
96
+ The plugin appears as a **"Theme"** section in Settings.
232
97
 
233
98
  ### Method 2: npx (No Global Install)
234
99
 
235
- If you don't have `dsh` installed globally, use `npx`:
236
-
237
100
  ```sh
238
101
  npx @deepseek-ai/dsh plugin --profile web add github:Tkingxiao/dsh-any-background
239
- # or:
240
- npx @deepseek-ai/dsh plugin --profile web add dsh-any-background
241
- ```
242
-
243
- Then launch:
244
-
245
- ```sh
246
102
  npx @deepseek-ai/dsh web
247
103
  ```
248
104
 
249
105
  ### Method 3: Local Build (Development)
250
106
 
251
- The `lib/` directory is committed, so installs need no build step. To rebuild after
252
- editing `src/`, run the bundle script (needs Node + pnpm):
107
+ The `lib/` directory is committed, so installs need no build step. To rebuild after editing `src/`:
253
108
 
254
109
  ```sh
255
- # 1. Clone this repo
256
110
  git clone https://github.com/Tkingxiao/dsh-any-background.git
257
111
  cd dsh-any-background
258
-
259
- # 2. Install the build tool (also pulls the @deepseek-ai/dsh-home-paths runtime dep)
260
112
  pnpm install
261
-
262
- # 3. Rebuild lib/
263
113
  pnpm run bundle
264
-
265
- # 4. Install the plugin into the web profile from the local checkout
266
- # (`dsh plugin add` wraps `pnpm add <dir>`, so point it at this directory)
267
114
  pnpm dsh plugin --profile web add "dsh-any-background"
268
-
269
- # 5. Launch
270
115
  pnpm dsh web
271
116
  ```
272
117
 
273
118
  ## Compatibility
274
119
 
275
- The plugin works on both the **Web UI** and the **desktop client**:
276
-
277
- - **[`dsh web`](https://github.com/deepseek-ai/deepseek-harness)** — Web profile, full support.
278
- - **[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.
279
-
280
- ## Dependencies
281
-
282
- | Package | Purpose |
283
- |---------|---------|
284
- | `@deepseek-ai/cordis` | Plugin framework (Cordis) |
285
- | `@deepseek-ai/dsh-home-paths` | Resolve the DSH data home for the persistence store |
286
- | `@deepseek-ai/dsh-client-runtime` | Client runtime + `defineStore` |
287
- | `@deepseek-ai/dsh-client-locale` | i18n (Chinese/English) |
288
- | `@deepseek-ai/dsh-client-ui-theme` | Theme service (register/setTheme/overrideTokens) |
289
- | `@deepseek-ai/dsh-invariants` | Package invariant companion |
290
- | `react` ^18.2.0 | UI rendering |
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.
291
122
 
292
123
  ## Star History
293
124