前言¶
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-theme 由 Carpon39038 維護,許可證爲 MIT。它是面向 DSH web client 的插件,核心流程是:
- 上傳或拖入一張圖片。
- 在瀏覽器中從圖片提取 five dominant colors in CIE Lab space。
- 將圖中最暗顏色用於 translucent glass surfaces。
- 允許用戶選擇一個提取顏色作爲 DSH accent。
- 在應用 theme tokens 前校正文字和強調色對比度。
- 將原圖作爲 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。
典型用法¶
下面是可復現的使用步驟:
- 打開 Settings → Image theme。
- 上傳或拖入一張圖片。
- 插件提取 five dominant colors in CIE Lab space。
- 從提取顏色中選擇一個作爲 DSH accent。
- 插件將 darkest image color 用於 translucent glass surfaces,並在應用 theme tokens 前校正 text and accent contrast。
- 原圖作爲 full-window background。
- 根據可讀性調整 dark overlay、blur、saturation 和 position。
- 如果之後要關閉效果,禁用插件即可;圖片和設置會保留。
適用場景與注意¶
適合以下場景:
- 想基於本地圖片快速定製 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-harness0.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。