Skip to content

feat(themes): model the OpenClaw dashboard themes - #2291

Merged
bkudiess merged 5 commits into
mainfrom
paulcam206-themes-01-model
Nov 26, 2026
Merged

bkudiess merged 5 commits into
mainfrom
paulcam206-themes-01-model

Conversation

@paulcam206

@paulcam206 paulcam206 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

The OpenClaw dashboard ships eleven built-in themes, plus plugin and imported themes served by the Gateway, but the Windows Companion only knows Fluent light and dark. This PR adds the shared model the Companion's theme support builds on. Nothing applies a theme yet, so there's no user-visible change.

It parses CSS colors (CSS Color 4, including color-mix() results), resolves the dashboard's palette tokens for light and dark, and derives the surfaces the Control UI computes in CSS rather than declaring as tokens: the sidebar mix, the opaque shell, the 78% composer fill and the accent-subtle user bubble. It also models the Gateway's themes.list/themes.get wire shapes and limits, expands plugin palettes, enforces a 3:1 legibility floor, and adds a tolerant persisted Appearance setting. Built-in palettes come from BuiltinGatewayThemes.g.cs, which scripts/Update-GatewayThemeTable.ps1 generates by resolving the Control UI cascade in headless Edge. It's pinned to openclaw/openclaw 4ffdd204, the commit the packaged Gateway 2026.11.1 ships. The generator fails closed: a theme id the stylesheets don't style can't silently inherit the default palette.

This is part 1 of 11 in the Companion themes stack, opened as a native GitHub stack: each PR is based on the layer below it, so its diff is only that layer. This PR is based on main, has a single commit, bbdefc6a feat(themes): model the OpenClaw dashboard themes, and no dependencies.

This commit is 429d16c2 rebased onto main 1af25869, and git range-diff shows the same patch plus one fix from this PR's first hosted review: the font-family grammar also accepts identifiers that start with --, as the Gateway's FONT_IDENTIFIER does (DefinitionAcceptsEveryFontIdentifierTheGatewayAccepts). Evidence and validation below name the heads they ran on; in this stack 429d16c2 is now 06874d8c, 783b9ed7 is now ce53645b and 2e98953a is now 539aa55e.

Rebased again onto main 30cfe593, which includes #2307 and #2308: this commit is now bbdefc6a (was 06874d8c), and git range-diff shows the same patch. Evidence below that names 06874d8c or an earlier head ran on this same patch.

Themes architecture

Layer 1 of 11 in the Companion themes stack. This layer adds the shared theme model the rest of the stack builds on: CSS color parsing, palette tokens and derived surfaces, the 3:1 legibility floor, plugin palette expansion, the Gateway theme wire shapes, the generated built-in table, the persisted Appearance setting, and the resolver that selects a theme from that setting. The nodes this pull request adds are highlighted below. For the full write-up, with code links, see OpenClaw Windows Companion: theme architecture.

flowchart TD
  subgraph src["Sources"]
    GW["Gateway"]
    UI["Settings page"]
    WIN["Windows settings"]
    SYNC["Daily table sync"]
    TBL["Built-in table"]
    FNT["Bundled fonts"]
    ARTA["Artwork images"]
  end
  subgraph proc["Processing"]
    CAT["Theme catalog"]
    FOL["Follower"]
    RES["Palette resolver"]
    PRB["WebView2 probe"]
    CCH["Palette cache"]
    MOD["Theme model"]
    SET["Appearance setting"]
    SEL["Theme selection"]
    ACC["Accent overlay"]
  end
  subgraph app["Application"]
    APL["Theme applicator"]
    PRJ["WinUI brushes"]
    RAD["Corner radii"]
    BKP["Mica backdrop"]
    ART["Chat artwork"]
    BUB["Lobster bubble"]
    BRD["Branding"]
  end
  GW -->|catalog and prefs| CAT
  GW -->|Control UI CSS| RES
  SYNC -->|regenerates| TBL
  TBL -->|fallback| RES
  RES --> PRB
  PRB --> CCH
  CCH -->|reuse| RES
  CAT -->|built-in names| RES
  CAT -->|plugin themes| MOD
  CAT -->|dashboard choice| FOL
  FOL -->|followed values| SET
  UI -->|manual choice| SET
  MOD --> SEL
  RES -->|built-in palettes| SEL
  SET --> SEL
  SEL --> ACC
  ACC --> APL
  WIN --> APL
  WIN --> BKP
  FNT --> PRJ
  APL --> PRJ
  APL --> RAD
  APL --> BKP
  APL --> BRD
  APL --> ART
  ARTA --> ART
  BKP --> BUB
  classDef layer fill:#ffd866,stroke:#7a5200,stroke-width:3px,color:#000000
  class MOD,TBL,SET,SEL layer
Loading

What Problem This Solves

The Companion has no model of the dashboard's themes, so it can't offer or render them.

User Impact

User impact: there's no user-visible change in this PR. It adds the data model and generated built-in palettes that the following PRs apply.

Why This Change Was Made

  • The Gateway's themes.list returns built-ins as descriptors only. Their colors live in the Control UI's CSS cascade, so the Companion needs a resolved table, generated from a pinned upstream ref rather than hand-copied.
  • Derived surfaces are modeled explicitly because the dashboard computes them in CSS (color-mix()). Without them the Companion rendered lighter, greyer surfaces than the dashboard.
  • Every value is validated: wire definitions against upstream's limits, and colors against a 3:1 text legibility floor measured on the surfaces as drawn (the canvas, the chat shell, cards, and the composer's 78% fill over the shell), so an unreadable plugin theme is never applied.

Evidence

  • A real Gateway's theme payload through this head's model: npm [email protected] ran on loopback with token auth, an isolated state directory and a local theme-only plugin, brandfonts, whose dark palette sets "font-sans": "--brand, sans-serif" and "font-mono": "--brand-mono, monospace". The Gateway's plugin loader validated the definition with its own normalizeThemeDefinition and served it. openclaw gateway call themes.list and openclaw gateway call themes.get --params '{"id":"brandfonts/brand-fonts"}' captured its results, and a small console program built against each head's OpenClaw.Shared passed them to GatewayThemeProtocol.ParseList, GatewayThemeProtocol.TryParseDefinition and ThemePaletteExpander.Expand. The previous head rejects the definition the Gateway serves, so a Companion would fall back to the Windows look; this head accepts it:

    == L1 at 26fda9407c9a816bffde2ff5cbf3fe8e8da0b18b
    themes.list: 12 themes (11 built-in): claw [Builtin, Light/Dark], knot [Builtin, Light/Dark], dash [Builtin, Light/Dark], absolutely [Builtin, Light/Dark], tide [Builtin, Light/Dark], beacon [Builtin, Light/Dark], phosphor [Builtin, Light/Dark], crt [Builtin, Light/Dark], manuscript [Builtin, Light/Dark], rose [Builtin, Light/Dark], miami [Builtin, Light/Dark], brandfonts/brand-fonts [Plugin, Dark]; current claw
    themes.get: theme brandfonts/brand-fonts, definition REJECTED
    TryParseDefinition: rejected: theme.dark fonts must contain only font family names
    == L1 at 06874d8c07cc880e23d3545b7a79109c6a7efb0b
    themes.list: 12 themes (11 built-in): claw [Builtin, Light/Dark], knot [Builtin, Light/Dark], dash [Builtin, Light/Dark], absolutely [Builtin, Light/Dark], tide [Builtin, Light/Dark], beacon [Builtin, Light/Dark], phosphor [Builtin, Light/Dark], crt [Builtin, Light/Dark], manuscript [Builtin, Light/Dark], rose [Builtin, Light/Dark], miami [Builtin, Light/Dark], brandfonts/brand-fonts [Plugin, Dark]; current claw
    themes.get: theme brandfonts/brand-fonts, definition accepted
    TryParseDefinition: accepted
    dark palette: canvas #14161a, body font [--brand, sans-serif], mono font [--brand-mono, monospace]
    
  • scripts/Update-GatewayThemeTable.ps1 -UpstreamRef 4ffdd2047d192dd65554de3c8c46c0e0197c6e2a regenerates BuiltinGatewayThemes.g.cs byte-identically on this head (06874d8c, rerun after the rebase).

  • The derived shell, sidebar and composer fill match pixels sampled from the Control UI in Edge for Manuscript dark on Gateway 2026.11.1 (GatewayThemeTests.DerivedSurfacesMatchControlUiPixels); every built-in in both modes passes the legibility floor, and a theme readable only on an opaque composer is rejected (GatewayThemeTests.GatewayThemeWithUnreadableTextIsNeverApplied).

  • Settings compatibility: Appearance is an optional, additive field. Settings without it, or with a malformed one, keep every other setting and load as Windows default (MalformedAppearanceNeitherDiscardsSettingsNorAppliesATheme); a selected Gateway theme survives a save and reload (SelectedGatewayThemeSurvivesSettingsRoundTrip). CI's "Run latest stable profile compatibility" step opens a profile written by the latest stable portable release with this head and checks that gateways, identities and preferences are preserved.

  • Applied in the next PR, the Manuscript dark canvas, sidebar and composer render #211E18, #211E18 and #2C2920, exactly the dashboard's values. The earlier themes build ee37371f, without these derived surfaces, rendered #26241D, #25221B and #3B372F.

Upgrade from the released Companion, run on a Windows 11 guest in light mode for the runtime-palette PR stacked on this one (#2301, at its earlier head 2e98953a, which contained this stack's previous top 783b9ed7): the latest stable Companion, v2026.11.3 (portable zip, SHA-256 verified against the release digest, the artifact CI's released-profile check uses), was paired to a real Gateway 2026.11.4 on an isolated profile, then that build opened the same profile. Notification settings, App theme Dark, the gateway record, device id and device token were preserved, with no new pairing request. Manuscript, picked in Settings, stayed applied in dark mode after a restart (canvas #211E18), and the only settings.json change was the added Appearance block. Capture after the upgrade and restart; the settings diff and full record are in #2301's description.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • none: this PR adds shared model code and a generated table with no UI or runtime path; it's proven by unit tests, a generator run and a real Gateway's theme payload parsed at this head. The visible behavior is proven in the PRs that apply it.

Validation

  • After rebasing onto main 30cfe593 (fix: match inline code chips to the chat theme #2307), on the new stack top 601932d6, which contains this commit: ./build.ps1 succeeded; dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 6016 passed, 0 failed, 29 skipped (existing opt-in integration skips); dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 6807 passed, 0 failed; dotnet test ./tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -r win-x64 --filter "FullyQualifiedName~GatewayTheme|FullyQualifiedName~GatewayBuiltinThemeProbe|FullyQualifiedName~DesktopCompanionWindowTests.OpenBubble|FullyQualifiedName~ReactorMarkdownWebParity|FullyQualifiedName~ReactorToolActivityProofTests|FullyQualifiedName~WorkAlignment": 63 passed, 0 failed.
  • After rebasing onto main 1af25869, on the new stack top 539aa55e, which contains this commit: ./build.ps1 succeeded; dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 6012 passed, 0 failed, 29 skipped (existing opt-in integration skips); dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 6801 passed, 0 failed; dotnet test ./tests/OpenClaw.Tray.UITests -r win-x64 --filter "FullyQualifiedName~GatewayTheme|FullyQualifiedName~GatewayBuiltinThemeProbe|FullyQualifiedName~DesktopCompanionWindowTests.OpenBubble" (developer machine, Windows dark mode): 29 passed, 0 failed.
  • On 06874d8c itself: ./build.ps1 succeeded; Shared tests with --filter "FullyQualifiedName~Theme|FullyQualifiedName~Appearance": 70 passed, 0 failed; Tray tests with --filter "FullyQualifiedName~Theme|FullyQualifiedName~Settings|FullyQualifiedName~Appearance|FullyQualifiedName~DesktopCompanion|FullyQualifiedName~Chat": 2550 passed, 0 failed. The new DefinitionAcceptsEveryFontIdentifierTheGatewayAccepts fails both -- cases without the fix.

On 429d16c2:

  • ./build.ps1: all builds succeeded.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore --filter "FullyQualifiedName~Theme|FullyQualifiedName~Appearance": 67 passed, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore --filter "FullyQualifiedName~Theme|FullyQualifiedName~Settings|FullyQualifiedName~Appearance|FullyQualifiedName~DesktopCompanion|FullyQualifiedName~Chat": 2550 passed, 0 failed.
  • ./scripts/Update-GatewayThemeTable.ps1 -UpstreamRef 4ffdd2047d192dd65554de3c8c46c0e0197c6e2a then git diff --exit-code: the regenerated table is identical to the committed one.
  • Full suites on the stack top 783b9ed7, which contains this commit: ./build.ps1 succeeded; dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 5982 passed, 0 failed, 29 skipped (existing opt-in integration skips); dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 6791 passed, 0 failed.

Real Behavior Proof

  • Environment tested: Windows 11 developer machine with Microsoft Edge and an authenticated gh; a real Gateway, npm [email protected], on 127.0.0.1 with token auth, an isolated state directory and the theme-only plugin brandfonts loaded through plugins.load.paths.
  • PR head or commit tested: 06874d8c (this head) and 26fda940 (this PR's previous head, before the font grammar fix).
  • Exact steps or command run: openclaw gateway call themes.list --json and openclaw gateway call themes.get --json --params '{"id":"brandfonts/brand-fonts"}' against that Gateway, then a console program built against each head's src/OpenClaw.Shared parsing both results; .\scripts\Update-GatewayThemeTable.ps1 -UpstreamRef 4ffdd2047d192dd65554de3c8c46c0e0197c6e2a, then git diff --exit-code src/OpenClaw.Shared/Themes/BuiltinGatewayThemes.g.cs.
  • Evidence after fix: the console output in Evidence above; the regenerated table is identical to the committed one; the theme tests above pass.
  • Observed result: the real Gateway lists its 11 built-ins and the plugin theme, and this head parses all 12 and accepts the plugin definition with its --brand font stacks, which the previous head rejected (theme.dark fonts must contain only font family names). The generator resolves 11 built-in themes, each with a light and dark palette, fonts, radii and branding, from upstream CSS.
  • Screenshot or artifact links verified? (Yes/No/N/A) N/A: text output is inline.
  • Not verified or blocked: rendering, which this model layer does not do (the next layer applies themes); themes imported through a signed-in person's profile (themes.import needs an authenticated profile, so the plugin route was used; both reach the Companion through the same definition parser).

Security Impact

  • New permissions or capabilities? (Yes/No) No
  • Secrets or tokens handling changed? (Yes/No) No
  • New or changed network calls? (Yes/No) No
  • Command or tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any answer is Yes, explain the risk and mitigation: N/A. The generator is a developer script; it reads upstream files through gh and runs headless Edge on a temporary local page.

Compatibility and Migration

  • Backward compatible? (Yes/No) Yes
  • Config or environment changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, list the exact upgrade steps: none. Settings files without Appearance keep the Windows look; malformed Appearance values fall back field by field.

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@paulcam206
paulcam206 added this pull request to stack #2302 November 18, 2026 00:03
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Adds shared Gateway theme models, color conversion, generated palettes, legibility checks, and optional persisted appearance settings.

Example: A user upgrades from Companion v2026.11.3 with App theme set to Dark.

  • Before: The profile has no Appearance field.
  • After: Dark remains selected; the new Appearance field is optional and defaults to the Windows look.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent feature foundation with useful boundary tests, real producer payload evidence, and supplied application upgrade proof.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Real Gateway CLI output exercises the model through a console harness, generator output is reported reproducible, and the dependent stack demonstrates stable-profile upgrade and restart through Companion; matching earlier-head blobs support proof reuse.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Companion cannot represent the dashboard's built-in, plugin, or imported themes.
Reason: Maintainer authorship establishes direction, and this independently reviewable model layer enables the active rendering stack while preserving existing preferences.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored foundation is absent from current main, supports an active theme stack, and has no actionable correctness or security findings.

Priority: P3
Reviewed head: bbdefc6a1e6b3a01af655d86a5b135d69b4396be

Before merge

None.

Findings

None.

Agent review details

How this fits together

The shared library converts Gateway theme JSON, bundled palette data, and saved appearance choices into validated theme values for later Companion rendering layers.

flowchart TD
  A[Gateway theme JSON] --> B[Protocol parser]
  C[Generated built-in palettes] --> D[Appearance resolver]
  E[Saved appearance settings] --> D
  B --> F[Palette expansion]
  F --> G[Legibility validation]
  G --> D
  D --> H[Future theme applicator]
Loading

Technical review

Best possible solution:

Land this coherent shared-model layer while retaining the existing Windows appearance default and leaving rendering to the dependent layer.

Do we have a high-confidence way to reproduce the issue?

This is a feature addition; source confirms current main lacks the shared Gateway theme model.

Is this the best way to solve the issue?

The smallest coherent foundation needs protocol parsing, palette conversion, and tolerant persistence; the additions serve that boundary without introducing a competing runtime theme owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c38dbcc53e7d.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Paul Campbell: Raw commit 30cfe59 adds src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs:238 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 30cfe5933473; files: src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This optional feature foundation has no immediate visible behavior change or urgent user regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-18T00:15:58.169Z sha 26fda94 :: needs changes before merge. :: [P2] Accept double-hyphen font identifiers supported by the Gateway
  • reviewed 2026-11-18T01:55:55.623Z sha 06874d8 :: needs maintainer review before merge. :: none

Reviewed November 18, 2026, 6:44 PM ET / 23:44 UTC (Revision 3).

@paulcam206

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 18, 2026
@paulcam206
paulcam206 marked this pull request as ready for review November 18, 2026 02:33
Add the shared theme model the Companion's appearance will build on:
CSS Color 4 parsing, resolved light and dark palettes in the Control
UI's vocabulary (including the surfaces it derives in CSS: sidebar mix,
shell, 78% composer fill and accent-subtle user bubble), the Gateway's
themes.list/themes.get wire shapes and definition limits, plugin palette
expansion, a 3:1 legibility floor, and a persisted, tolerant appearance
setting. Built-in palettes come from a table generated by
scripts/Update-GatewayThemeTable.ps1, which resolves the Control UI
cascade in headless Edge at a pinned openclaw/openclaw ref (here the
packaged Gateway 2026.11.1, 4ffdd204). Nothing applies a theme yet.
@paulcam206
paulcam206 force-pushed the paulcam206-themes-01-model branch from 06874d8 to bbdefc6 Compare November 18, 2026 22:56
@paulcam206

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@bkudiess
bkudiess merged commit ff76e68 into main Nov 26, 2026
32 checks passed
@bkudiess
bkudiess deleted the paulcam206-themes-01-model branch November 26, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants