DSH Image Theme:从一张本地图片生成 DeepSeek Harness 主题

前言

DSH web client 的主题外观通常由 theme tokens 控制。如果想在项目里临时换成一张本地图片风格,通常需要手工取色、调整背景、玻璃面、强调色和文字对比度。DSH 提供插件、settings-slot 和 theme-token APIs,社区可以用插件的方式完成这类界面定制;社区目录是独立站点,不等同于官方应用商店,也不与 DeepSeek / 幻方构成官方从属关系。

下面介绍 Carpon39038/dsh-image-theme:一个 Warp-inspired image-to-theme plugin for the DeepSeek Harness web client。

这是什么

Carpon39038/dsh-image-themeCarpon39038 维护,许可证为 MIT。它是面向 DSH web client 的插件,核心流程是:

  1. 上传或拖入一张图片。
  2. 在浏览器中从图片提取 five dominant colors in CIE Lab space。
  3. 将图中最暗颜色用于 translucent glass surfaces。
  4. 允许用户选择一个提取颜色作为 DSH accent。
  5. 在应用 theme tokens 前校正文字和强调色对比度。
  6. 将原图作为 full-window background。

它不是直接改宿主 UI 的硬编码样式,而是通过 DSH 的主题接口生成 token overrides。

核心功能

下面按能力分节说明。

图片上传与调色板提取

插件支持在 Settings → Image theme 中上传或拖入图片。提取结果是五组颜色,提取过程使用 deterministic five-color Lab k-means palette extraction in the browser。

“deterministic”在这里表示同样的输入会生成同样的调色板结果。

主题映射

插件会把图片中的颜色映射到 DSH 的主题角色中:

  • 最暗图片颜色:用于 translucent glass surfaces。
  • 用户选中的提取颜色:作为 DSH accent。
  • 原图:作为 full-window background。
  • 文字和 accent:在应用前进行 contrast correction。

主题覆盖通过下面的 DSH 接口完成:

ctx.theme.overrideTokens()

这意味着插件不会进行 hard-coded edits to the host UI。

背景渲染

插件会把原图作为 full-window background 使用,并允许调整:

  • dark overlay
  • blur
  • saturation
  • position

这些调整都围绕同一张图片进行,不需要额外上传图片。

设置入口

插件提供独立的 Settings → Image theme 区域,包含:

  • drag-and-drop upload
  • palette controls
  • responsive settings UI
  • reduced-motion support

本地存储与隐私

图片不会上传:

  • image 以 Blob 形式存储在 IndexedDB
  • settings 存储在 localStorage

因此,图片和偏好设置是 browser-local 的。

禁用行为

插件可以禁用,但不会丢失已选择的图片与设置。

安装与启用

从 GitHub 安装

先执行下面的命令,把插件添加到指定 DSH profile:

dsh plugin --profile <profile-name> add github:Carpon39038/dsh-image-theme

然后重启或刷新 DSH web client,打开:

Settings → Image theme

本地开发安装

本地开发需要:

Node.js 22+
pnpm 10+

先安装依赖并构建:

pnpm install
pnpm build

再用本地目录安装:

dsh plugin --profile <profile-name> add link:$PWD

仓库中的 .npmrc 会禁用 automatic peer installation。这是有意设置:DSH supplies the client runtime and UI services,而 current public RC packages still reference workspace-only transitive packages that are not published to npm。

典型用法

下面是可复现的使用步骤:

  1. 打开 Settings → Image theme
  2. 上传或拖入一张图片。
  3. 插件提取 five dominant colors in CIE Lab space。
  4. 从提取颜色中选择一个作为 DSH accent。
  5. 插件将 darkest image color 用于 translucent glass surfaces,并在应用 theme tokens 前校正 text and accent contrast。
  6. 原图作为 full-window background。
  7. 根据可读性调整 dark overlay、blur、saturation 和 position。
  8. 如果之后要关闭效果,禁用插件即可;图片和设置会保留。

适用场景与注意

适合以下场景:

  • 想基于本地图片快速定制 DSH web client 外观。
  • 想避免手工修改宿主 UI。
  • 想在一个浏览器 profile 内保留一组本地图片和主题设置。

需要注意以下限制:

  • 插件是 web-only。
  • images and preferences are local to each browser profile,不会在不同设备之间同步。
  • initial version targets the DSH web plugin APIs inspected at deepseek-harness 0.1.0-rc.5
  • 升级到 newer release 前,应检查 theme 和 settings-slot contracts。
  • 许可证为 MIT。
  • 插件会以当前 dsh 进程权限运行;安装前应检查源码与许可证。

结尾

Carpon39038/dsh-image-theme 的价值在于把“从一张本地图片生成 DSH 主题”做成可安装、可禁用、可保留设置的 web 插件。它不上传图片,不硬编码宿主 UI,适合需要快速切换 DSH web client 外观的场景。

GitHub:

https://github.com/Carpon39038/dsh-image-theme

目录页:资料未提供目录页 URL。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye