DeepSeek Harness Custom CSS Plugin

Introduction

When modifying UI styles in DeepSeek Harness, you need to consider injection timing and style precedence. Host-side injection often lands before the built-in stylesheets, making it difficult for custom rules to override them; browser-side injection, while it can be appended to the end of <head>, lacks a unified configuration entry point.

hluica/dsh-custom-css adds a single “User CSS” row to the settings page. It injects user stylesheets via browser-side injection, appending them after the built-in stylesheets and ensuring they always come after the theme stylesheet. Simply edit a CSS snippet in settings and click “Save & Apply” for instant effect — no page reload or DeepSeek Harness restart required.

Plugin Overview

hluica/dsh-custom-css is a DeepSeek Harness plugin that injects user-defined CSS snippets into the interface. The plugin only permits references to local files, does not enforce syntax or format validation, and provides editing and persistence through a settings-row editor and a dedicated user.css file.

Installation & Activation

Install from the GitHub repository:

dsh plugin add github:hluica/dsh-custom-css

After installation, open Settings → General in DeepSeek Harness, locate the “User CSS” row, click the summary button on the right to expand the editor, enter your CSS, and click “Save & Apply.”

Usage

  1. Open Settings → General and locate the “User CSS” row.
  2. Click the summary button on the right to expand the editor, then write CSS in the text field.
  3. Click Save & Apply. Styles take effect immediately — no page reload or restart needed.

The summary button displays the injection status: “Not injected” when no snippet has been saved, otherwise “Injected.” A button below the editor indicates whether there are unsaved changes.

A hint below the text field reads: Press F12 to open DevTools for quickly inspecting the UI source code currently in use by DeepSeek Harness (including any CSS you have injected).

File Location & Application Timing

The CSS snippet is stored in the plugin’s own data directory:

$DSH_HOME/dsh-custom-css/user.css      # Default: ~/.dsh/dsh-custom-css/user.css

This file is the single source of truth and can be edited with any text editor. While a page is open, the file is re-read every 5 seconds, and saving does not rely on browser caching. The settings-row editor is simply a frontend for this file.

Injection Position & Precedence

The snippet is written into a <style> element appended to the end of document.head. This is the core of this plugin: the built-in stylesheets already occupy <head>, and only stylesheets appended after them can win the cascade at equal specificity.

For example, you can directly write selectors to override built-in styles without !important:

.dsw-sidebar { border-right: 1px solid #888; }

By contrast, the Host-side webserver/index-inject mechanism can only insert content immediately after the <head> opening tag, placing it before the built-in stylesheets. At equal specificity, it will be overridden. This plugin places injection on the browser side, resolving this issue.

Ordering Relative to the Theme Stylesheet

@deepseek-ai/dsh-client-ui-theme appends its palette as a <style> element to head during apply(), and rewrites it whenever the theme changes. This plugin guarantees that the user stylesheet always comes after the theme stylesheet:

  • The plugin declares inject: [..., 'theme'], so the theme service is ready first;
  • Inside apply(), the existing <style> node is appendChild-ed again (the same node is moved, not duplicated), placing it visually at the end of head;
  • It listens to theme/change and re-appends after the theme rewrites its palette, preventing the user stylesheet from being pushed before the newly inserted theme stylesheet.

Custom Properties & the Cascade

Custom properties are resolved per element during the computed-value phase and are independent of stylesheet order. In other words, even if this plugin’s stylesheet came before the theme’s, var(--dsw-alias-bg-base) would still resolve to the theme’s value — as long as the element can inherit that variable from an ancestor (the theme declares its variables on body).

The ordering guarantee solves a different concern: cascade resolution when a user rule and a theme rule have the same specificity and target the same property. For example, if the theme defines body{background-color:var(--dsw-alias-bg-base)} and you want to change the background via body{background-color:…}, the later rule wins at equal specificity — this plugin comes last, so the user wins.

Conclusion: Using built-in color variables does not depend on load order. The appended ordering simply ensures that “overriding the theme at equal specificity” is reliably stable.

Using Built-in Color Variables

The theme defines approximately 190 semantic variables on body, with one set each for light and dark modes; dark mode is applied via body[data-ds-dark-theme] overrides. Reference them in your custom CSS for automatic theme adaptation:

.my-panel {
  color: var(--dsw-alias-label-primary);
  background: var(--dsw-alias-bg-layer-2);
  border: 1px solid var(--dsw-alias-border-l2);
}

Common variables and their light/dark values:

Variable Purpose Light Dark
--dsw-alias-bg-base App background …bluish-00 (#fff) …bluish-950 (#151517)
--dsw-alias-bg-layer-1/2/3 Layered surfaces bluish-00 bluish-875/850/800
--dsw-alias-bg-overlay Overlay bluish-150 bluish-700
--dsw-alias-bg-module-platform Control background bluish-60 bluish-800
--dsw-alias-label-primary Primary text bluish-1000 (#0f1115) bluish-50 (#f9fafb)
--dsw-alias-label-secondary Secondary text bluish-700 bluish-300
--dsw-alias-label-tertiary Tertiary text bluish-600 bluish-400
--dsw-alias-label-primary-foreground Text on primary btn bluish-00 bluish-1000
--dsw-alias-border-l1 … l4 Borders (weak→strong) #0000000a → #00000029 #ffffff0f → #fff3
--dsw-alias-brand-primary Brand primary bluish-1000 bluish-50
--dsw-alias-link Links deepseek-500 deepseek-400
--dsw-alias-state-error-primary Error red-600 red-400
--dsw-alias-state-success-primary Success green-500 green-500
--dsw-alias-state-warn-primary Warning amber-500 amber-500
--dsw-alias-interactive-bg-hover Hover background #2631480f #ffffff14
--dsw-alias-markdown-code-block Code block bg bluish-50 bluish-900
--dsw-specific-sidebar-fill Sidebar background bluish-50 bluish-900
--dsw-alias-tooltip-bg Tooltip background bluish-850 bluish-750

There are also --dsw-static-* static color scales (unchanged across themes) and --dsw-font-* typography variables. You can inspect the full list in DevTools via the computed styles on body, or search through the settings-row hints.

Do not use @media (prefers-color-scheme: dark) to detect light/dark: DSH toggles via the body[data-ds-dark-theme] attribute (the theme preference may be system, but the runtime mechanism is still this attribute). When writing theme-specific styles, target this attribute or use the variables above directly.

Local Files Only

The snippet is scanned before saving and before application. The following will be blocked with a line-number report, and the current CSS will not take effect:

  • @import referencing external resources (both url() and string syntax)
  • url() referencing external resources

Detection rule: Anything with a protocol (http:, https:, data:, file:, blob:, ftp:, etc.) or protocol-relative (//host/…) is considered external.

Syntax Result
url(./x.png), url(../x.png), url(/abs/x.png), url(#grad) ✅ Allowed
url(https://…), url(//host/…), url(data:…), url(file:…) ❌ Blocked
@import "https://…", @import url(https://…) ❌ Blocked

References inside comments will not trigger false positives. Beyond this restriction, no CSS syntax validation or formatting is performed.

Self-Rescue When Things Break

  • In the editor: Click “Discard Changes” to drop the unsaved draft.
  • If the snippet renders the UI unusable: directly clear or edit ~/.dsh/dsh-custom-css/user.css. Already-open pages will automatically re-read the file within a few seconds; reloading the page applies it immediately.
# Truncate to restore defaults
: > ~/.dsh/dsh-custom-css/user.css

If reading the config file fails, the settings row will display “Read failed” and disable saving, preventing empty content from overwriting existing CSS. You can click “Retry” first, or restart DeepSeek Harness as prompted.

Use Cases & Cautions

  • Ideal for users who need to fine-tune UI styles, fix display issues, or unify visual styling.
  • The plugin runs with the permissions of the current DeepSeek Harness process. It is recommended to review the source code and license before installing.

Conclusion

hluica/dsh-custom-css provides a unified “User CSS” configuration entry in the settings page. It appends user styles after the built-in stylesheets via browser-side injection, guarantees ordering after the theme stylesheet, and supports built-in color variables for automatic light/dark theme adaptation.

  • Plugin directory page: https://www.skillhub.cn/plugins/hluica/dsh-custom-css
  • GitHub repository: https://github.com/hluica/dsh-custom-css
羽毛球分组比赛记分
小程序二维码

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

Xiaoye