DarkskyX15/dsh-client-ui-m3-theme

Material 3 theme plugin for DeepSeek Harness: derives the full --dsw-* color token set from one primary color, with separate light/dark palettes (per-mode chroma, fixed contrast surfaces), plus a settings panel with color picker, presets and live preview.

项目介绍Project Overview

这是 DSH 的 Material 3 主题插件,双面架构:宿主端注册 m3-theme 设置命名空间并注入启动主色,浏览器端从单一主色派生约 65 个 --dsw-* 颜色令牌,生成独立明暗调色板,并提供设置面板开关主题、切换颜色来源(localStorage 或 settings.yaml)与选色,支持中英双语。适合想统一界面配色又只调一个主色的场景。注意:面板选色仅写入 localStorage,不会回写 settings.yaml;安装或改宿主端后需重启 DSH。

This is a Material 3 theme plugin for DSH with a dual-face package: the host half registers the m3-theme settings namespace and injects a boot primary color, while the browser half derives the full set of ~65 --dsw-* color tokens from one primary color into separate light/dark palettes, and adds a settings panel to toggle the theme, switch color source (localStorage or settings.yaml), and pick a color, with zh/en i18n. Use it to restyle the UI from a single primary color. Caveat: panel picks write only to localStorage, never back to settings.yaml, and host-side changes require a DSH restart.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:DarkskyX15/dsh-client-ui-m3-theme

DarkskyX15/dsh-client-ui-m3-theme 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-client-ui-m3-theme

Material 3 theme plugin for DeepSeek Harness (dual-face package): derives the full --dsw-* color-token set from a single primary color, with separate light/dark palettes, plus a settings panel for enabling the theme and choosing the color.

中文说明

Features

  • Full mapping of ~65 visible --dsw-* color tokens (surfaces, borders, text, brand, buttons, interactive states, markdown, scrollbars, status colors, component-specific surfaces, toast/tooltip).
  • Separate light/dark palettes derived from one primary color:
    • dark neutral surfaces/borders carry slightly higher chroma (M3 dark-scheme practice);
    • the dark primary palette boosts chroma to compensate for lost saturation on dark backgrounds;
    • tooltip is a fixed inverted surface (bubble text is static white), so its background stays dark in both modes;
    • the five text levels (primary → secondary → tertiary → caption → dimmed) align with the shipped lightness ladder.
  • Settings panel "M3 Theme":
    • enable/disable switch for the whole token layer;
    • color-source switch: browser-local color (localStorage) or machine config (settings.yaml injection);
    • one custom primary color picker;
    • priority explainer card;
    • zh/en i18n — panel and nav copy follow the UI language.
  • Persistence:
    • browser pick → localStorage key dsh.m3-theme.primary (instant effect, cross-tab sync);
    • machine config → settings.yaml namespace m3-theme (registered by the host half, injected into the page as window.__DSH_M3_THEME_PRIMARY__);
    • switches → dsh.m3-theme.enabled ('0' disables the layer) and dsh.m3-theme.useLocal ('0' ignores localStorage and uses the injected value).

Primary color resolution

useLocal switch Resolution order
ON (default) localStorage → settings.yaml injection → built-in purple #6750a4
OFF settings.yaml injection → built-in purple #6750a4 (localStorage ignored)

Panel picks are written only to localStorage — they never write back to settings.yaml.

Install into a DSH profile

  1. Add the git dependency to the profile's package.json:

    {
      "dependencies": {
        "dsh-client-ui-m3-theme": "github:DarkskyX15/dsh-client-ui-m3-theme#v0.2.0"
      }
    }
    

    To track the branch instead: "github:DarkskyX15/dsh-client-ui-m3-theme#main".

  2. Insert the entry into the profile's cordis.patch.yml:

    - insert:
        - id: ui-m3-theme
          name: dsh-client-ui-m3-theme
    
  3. Reinstall and restart DSH:

    pnpm install
    

    (The host half registers the settings namespace and injects the boot color; the client bundle is scanned at startup, so restart the DSH process.)

Usage

  • Settings → M3 Theme: toggle the theme, choose the color source, pick the primary color.

  • External config — edit ~/.dsh/settings.yaml:

    m3-theme:
      primary: "#39c500"
    

    With the "browser-local color" switch ON, the browser pick takes precedence over this value; turn the switch OFF to use it directly.

Structure

  • lib/index.js — host half: registers the m3-theme settings namespace (schema validation) and injects the boot primary via webServer.tapIndex.
  • lib/client.js — browser half: window.__ModuleLoader__.load registration, token derivation (hex↔HSL, tone stepping, per-mode palettes), the settings panel, and zh/en dictionaries.
  • No build step: lib/ is the shipped artifact — commit changes directly.

Development

node --check lib/client.js   # syntax check
node --check lib/index.js

The browser bundle is served by the /plugins/<id>/client.js route, which reads the file from disk on every request (cache-control: no-cache): after editing lib/client.js a page refresh is enough. Changes to lib/index.js (host half) or package.json require a DSH restart.

License

MIT

上一个 Prev ds-image-skin 下一个 Next deepseek-harness-blaxel-sandbox