tzy168/dsh-web-theme-packs

Plugin插件 Native原生 ⭐ 2 UI & Themes界面与主题

这是一个用于自行更换主题的dsh插件。

Project Overview项目介绍

dsh-web-theme-packs is an out-of-tree DSH Web plugin that scans directories for theme folders (colors, CSS, fonts, images) and registers them with ThemeRuntime, letting the existing layout presenter apply --dsw-* semantic tokens. Multiple packs coexist and are switched via Settings → General → Theme packs. Use it to skin the three-column Web client or ship brand assets without altering layout or icon components. Caveat: it cannot redraw window chrome or replace React icons; an incomplete third-party token set leaves built-in aliases in place, potentially mixing palettes; custom pack ids live outside the built-in ui-theme.preference schema, and uninstalling the plugin drops the active selection without rewriting the last Appearance choice.

DSH 外部 Web 插件,将主题文件夹(颜色、CSS、字体、图片)注册到 ThemeRuntime,按 --dsw-* 语义令牌覆盖外观,多套包可并存在设置中切换。适用于需要为三栏 Web 客户端定制皮肤、品牌色或新增资源而保持布局与图标组件不变的场景。注意:插件仅改写令牌和附加 CSS,不能替换窗口装饰、React 图标或重排栏位;第三方不完整令牌集会与内置别名混用;自定义包 id 不在 ui-theme.preference 内,卸载插件会丢失所选包。

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

CLI Install命令行安装

dsh plugin --profile web add github:tzy168/dsh-web-theme-packs

tzy168/dsh-web-theme-packs 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-web-theme-packs

English | 中文

Out-of-tree Web plugin: drop folders of theme files (colors, extra CSS, fonts, images) into a scanned directory, and the plugin registers them with ThemeRuntime so the existing layout presenter applies --dsw-* tokens. Multiple packs can sit side by side; Settings → General → Theme packs switches among them. This is a standalone bundle that will move to its own repository; it is not part of the shipped dsh-web-app roster.

Codex-style skins that replace window chrome, icon sets, and layout are a different format. A DSH pack overrides semantic tokens and may add CSS/assets on top of the three-column Web client. It cannot replace React icon components or rearrange columns.

Install

From this checkout, after pnpm install at the repository root:

pnpm --filter dsh-web-theme-packs bundle
pnpm dsh plugin --profile web add ./dsh-web-theme-packs
pnpm dsh web

dsh plugin add records the bundle on the profile. Removing it is pnpm dsh plugin --profile web remove dsh-web-theme-packs.

Pack format

Each pack is a directory that contains theme.json. Default scan roots are this package's themes/ (shipped examples) and $DSH_HOME/theme-packs (created on first load). Drop a new folder into the user root; the Host watches the directory and the browser refreshes the catalog.

theme.json:

{
  "id": "aero-blue",
  "name": "Aero Blue",
  "description": "Optional one-line label",
  "colorScheme": "light",
  "tokens": {
    "--dsw-alias-bg-base": "#c5e4f7",
    "--dsw-alias-brand-primary": "#1a5f9e"
  },
  "css": "theme.css",
  "preview": "preview.svg",
  "fonts": [
    { "family": "PackSans", "file": "fonts/pack.woff2", "weight": 400 }
  ]
}

Rules:

  • id matches ^[a-z][a-z0-9-]*$ and must not be light, dark, or system.
  • colorScheme is the base palette (body[data-ds-dark-theme]).
  • tokens keys are CSS custom properties; values are strings. Relative url(...) values are rewritten to /dsh-theme-packs/<id>/....
  • css, preview, and font file paths are pack-relative (no .., no absolute paths). Missing files skip that pack and leave the others loaded.
  • Extra CSS may target body[data-dsh-theme-pack="<id>"]. Relative url() values are rewritten the same way.
  • Pack JSON and CSS are data. The loader never evaluates JavaScript from a pack.

Inspect the live token directory with the Cordis tools (theme.exportInspectTokens) or by reading design-platform.css. A partial token map is valid; unspecified aliases keep the built-in sheet.

Shipped examples: themes/aero-blue (light glossy blue), themes/ink-night (dark navy), and themes/misty-forest (light fog-and-pine wallpaper).

Configuration

- id: web-theme-packs
  name: dsh-web-theme-packs
  config:
    roots:
      - !!js dshHomePath('theme-packs')
    routePrefix: /dsh-theme-packs

An empty roots list (the default) scans bundled themes/ then $DSH_HOME/theme-packs. Later roots win on duplicate ids. routePrefix must start with /, must not be /, and must not end with /.

The Host serves GET {prefix}/catalog.json, GET {prefix}/events (SSE revision stream), rewritten {prefix}/{id}/theme.css, and other pack files. The selected pack id is stored in the theme-packs.active settings section; Light / Dark / System under Appearance clears it.

Model Experience

None; the plugin manages a browser preference and static assets. Nothing here reaches a model request.

KV Cache effect

None; this package neither assembles nor sends a provider request.

Known Limitations and Deferred Work

  • Packs skin tokens and optional CSS, not the layout or icon components. A Codex QQ-2007 skin that redraws chrome and skeuomorphic icons has no equivalent asset map in this client.
  • Third-party token sets are not completeness-checked. An incomplete override leaves built-in aliases in place, which can mix palettes.
  • Custom pack ids are outside the built-in ui-theme.preference schema. Persistence of the selected pack is this plugin's theme-packs.active field; removing the plugin drops that selection without rewriting the last Appearance preference.
上一个 Prev dsh-cost 下一个 Next dsh-sm-context-piano