DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

YangAtC /

dsh-theme

Topic repository only

DSH (DeepSeek Harness) 主题自定义插件:背景图 + 界面透明度调节,开箱即用

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: master@1db7d0c0

@yangatc/dsh-theme

DSH(DeepSeek Harness)主题自定义插件:为网页版设置一个「主题」面板,支持:

  • 上传背景图片,三种显示模式:拉伸铺满(cover)、适应(contain)、居中(center)
  • 调节各界面层透明度:应用背景 / 面板表面 / 侧边栏 / 浮层,即时生效
  • 开箱即用:内置默认预设(背景图 + 透明度),新设备安装后无需任何配置即可看到主题效果
  • 设置持久化到磁盘,重启 DSH 后依然保留

主界面中消息文本、行内代码、代码块(含标题栏)、工具结果、任务清单、输入框、菜单、气泡等表面层背景均随「面板表面」滑杆半透明,露出背景图片。


原理

DSH 的 Web 端是 Cordis 组合。本插件是持久化的 profile 插件(不是一次性动态插件):

  • Host 半区(lib/index.js,运行在 DSH Node 进程):
    • 通过 ctx.connection.rpc.handle('/theme-custom', ...) 注册私有 RPC 通道,提供 get / save / upload / deleteBg 四个端点
    • 配置写入 $DSH_HOME/profiles/web/theme-config.json
    • 上传的背景图存到 $DSH_HOME/profiles/web/theme-assets/,通过 /theme-assets 前缀路由静态提供
    • 开箱即用:首次运行把包内 assets/default-bg.jpg 复制到 theme-assets/,并把 presets/default-config.json 作为默认配置,用户改动后以用户配置为准
  • Client 半区(lib/client.js,运行在浏览器):
    • 在 settings.section 插槽注册「主题」面板(id theme-custom,order 35)
    • 插件级 apply() 常驻应用背景图(独立 position: fixed 背景层,z-index -1,露出半透明表面)与 theme.overrideTokens(...) 透明度覆盖,面板开关不会撤销
    • 透明度通过 @deepseek-ai/dsh-client-ui-theme 的 overrideTokens(source, tokens) 写入 token(如 --dsw-alias-bg-base、--dsw-specific-tip、--dsw-alias-markdown-code-block 等),由 ui-layout 的 ThemePresenter 投射到 document.body 内联样式

安装

方式 A:npm 安装(推荐)

# 1. 把包装到 DSH web profile 的依赖里
cd "$DSH_HOME/profiles/web"
npm install @yangatc/dsh-theme

# 2. 把插件行挂到 cordis 组合(cordis.patch.yml)

在 $DSH_HOME/profiles/web/cordis.patch.yml 的 patches 里追加一行:

patches:
  - insert:
      - '@yangatc/dsh-theme'

DSH 会热重载(或重启 DSH 生效),浏览器刷新后「设置 → 主题」即可使用。

方式 B:便携拷贝

把整个项目(lib/、assets/、presets/、package.json)拷到:

$DSH_HOME/profiles/web/node_modules/@yangatc/dsh-theme/

然后同样在 cordis.patch.yml 加 - insert: '@yangatc/dsh-theme' 行。

$DSH_HOME 默认是 ~/.dsh(Windows:C:\Users\<你>\.dsh)。


使用

  1. 打开网页版 DSH → 设置(侧栏齿轮)→ 主题
  2. 背景图片:点「上传图片」选择本地图片;「拉伸铺满 / 适应 / 居中」切换显示模式;「移除背景」删除
  3. 界面透明度:四个滑杆(应用背景 / 面板表面 / 侧边栏 / 浮层)实时调节,100% 为完全不透明,越低越透出背景图
  4. 设置即时生效并自动保存

数据存放位置

内容 路径
主题配置 $DSH_HOME/profiles/web/theme-config.json
背景图片 $DSH_HOME/profiles/web/theme-assets/
静态服务 GET /theme-assets/<file>
包内默认预设(只读) <pkg>/assets/default-bg.jpg、<pkg>/presets/default-config.json

开箱即用:首次运行(用户从未配置过)时,插件自动把包内默认背景图复制到 theme-assets/ 并以默认透明度生效;用户上传新图或调整后,以用户配置为准。


开发

# 工作区装依赖后直接改 lib/ 下源码,无需构建(host 直接 ESM,client 为手写 __ModuleLoader__ bundle)

client bundle 由 DSH 的 client-modules 自动按 exports["./client"] 重建,文件变化后浏览器硬刷新(Ctrl+Shift+R)即可加载新 bundle(rev 自动变化)。


License

MIT

—/ 5

No ratings yet

Manifest verification required

Commit 1db7d0c03d6f

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout