Bundle
dsh-workspace-colors
外观增强:侧边栏工作区专属颜色 + 页面背景 tint(官方 token 覆盖层,含设置页),纯客户端插件
- Source
- MirrMeur
- License
- MIT
- Updated
- Updated 20 hours ago
Readme
# dsh-workspace-colors
DSH Web 外观增强插件(宿主半 + 浏览器半,零依赖):
1. **工作区颜色** —— 侧边栏每个工作区分配专属颜色:文件夹图标着色 + 标题行
左侧色条 + 整个分组微色底。深浅主题都适配。
2. **页面背景 tint** —— 给整个界面叠一层你选的颜色(官方
`ctx.theme.overrideTokens()` token 覆盖层,明/暗主题各自生效,内置的
浅色/深色/跟随系统偏好完全不受影响)。
3. **内存回收面板** —— 宿主半注册 `/ws-colors/api/reclaim` 只读状态接口,
上报 DSH 后端进程 RSS/CPU、Chrome renderer 渲染进程内存占用合计,
以及 `auto-reclaim.sh` 守护进程是否在跑;可开关 `~/.dsh/auto-reclaim.yaml`
里的 `enabled` 标志。
## 安装 / 升级
```sh
# 从 GitHub 装(推荐)
dsh plugin --profile web add github:MirrMeur/dsh-workspace-colors
# 钉住 tag
dsh plugin --profile web add github:MirrMeur/dsh-workspace-colors#v0.4.1
# 本地目录(link 挂载,改文件后重启即生效)
dsh plugin --profile web add file:/path/to/dsh-workspace-colors
```
重启 `dsh web` 生效(不是刷新浏览器)。
升级:
```sh
cd ~/.dsh/profiles/web # 或 $DSH_HOME/profiles/web
pnpm up dsh-workspace-colors
```
## 使用
打开 **设置 → 外观增强**:
- 页面背景:开关 + tint 色彩 + 强度滑杆,6 个预设(豆沙绿/暖米/天青/淡紫/
樱粉/墨蓝),全部实时生效,保存在浏览器 localStorage。
- 工作区颜色:开关 + 「重新分配」按钮。
- 内存回收:状态面板 + 开关。
## 颜色规则
- 色彩体系:全部基于 **OKLCH 感知均匀色彩空间**(Radix/Material 3 式 tonal
体系)—— 每个角色(色块/色条/图标)一组固定明度·彩度,只转色相,所有
工作区颜色自动同一质感;色块是**实色 tonal 层**而非透明度叠加,不会被
页面背景稀释。
- 工作区颜色:10 个 OKLCH 感知等距色相(红/橙/金/绿/青/天/蓝/紫/品红/玫),
按工作区首次出现顺序先到先得;映射按「名字 → 色相」存在 localStorage
(`dsh-workspace-colors.map`)。
**启用背景 tint 时,与背景色相相差 ≤45° 的工作区颜色会被自动改派**
(例如豆沙绿背景下,绿/青系工作区让位),关闭背景后恢复原分配。
手动指定:
```js
const m = JSON.parse(localStorage.getItem('dsh-workspace-colors.map'));
m['日常工作'] = 215; // 0-360 任意色相
localStorage.setItem('dsh-workspace-colors.map', JSON.stringify(m));
```
刷新页面生效。超过 10 个工作区按名字哈希回落,可能重复。
- 背景 tint:强度默认 45%。页面底色吃满强度,表面层(layer-1/2/3、侧栏)
依次衰减(0.7/0.5/0.35/0.7 倍),边框 0.3 倍,保持界面层次。原始值从
当前页面按明/暗两套捕获并缓存,官方主题/预设改动后重启页面即重新捕获。
## 存储键
| key | 内容 |
|---|---|
| `dsh-workspace-colors.config` | `{ workspaceColors, bg: { enabled, tint, strength } }` |
| `dsh-workspace-colors.map` | `{ 工作区名: 色相 }` |
## 宿主接口
| 方法 | 路径 | 说明 |
|---|---|---|
| `GET` | `/ws-colors/api/reclaim` | 只读状态:`{ enabled, thresholdGb, idleMinutes, daemonRunning, process:{pid,rssMb,cpu}, renderer:{count,rssMb,biggestPid} }` |
| `POST` | `/ws-colors/api/reclaim` | body `{action:"enable"\|"disable"\|"restart"}` |
`restart` 只在后端由 launchd 托管(`ppid === 1`)时才执行,否则返回 409
`not-launchd-managed` —— 手工启动的后端杀掉后不会自己回来。
## 兼容性
宿主半 `inject: ["webServer"]`,客户端半用 `slots` / `locale` / `theme` 服务与
`ctx.theme.overrideTokens()`,不 import `@deepseek-ai/*` 运行时包
(`dsh-client-runtime` 在 DSH 0.1.5 已被移除,本插件不依赖它)。
## 卸载
```sh
dsh plugin --profile web remove dsh-workspace-colors
```
## License
MIT
Install
dsh plugin --profile web add github:MirrMeur/dsh-workspace-colors
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-workspace-colors from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.