Skip to content

Commit 8e6c34f

Browse files
authored
feat(ui): user-selectable accent color for the Control UI (#128432)
* feat(ui): user-selectable accent color for the Control UI Adds an Accent color section to Settings -> Appearance: curated preset swatches plus a native custom color input. The choice persists as the gateway-synced ui.prefs.accent (#rrggbb) and takes precedence over the operator-level ui.seamColor, falling back to the active theme's accent when cleared. The shared apply path now also derives readable --accent-foreground/--primary-foreground ink from accent luminance, so light accents keep dark text on primary controls. Bundled accent-invariant cleanup: the embedded terminal resolves its background/cursor/foreground from live computed tokens instead of a hand-copied claw palette (fixes desync on knot/dash/custom themes), a baked rgba(255,92,92) gradient now uses color-mix over --accent, and duplicated diff-tint literals collapse into --danger-subtle/--ok-subtle. Environment branding moved behind a lazy runtime module (-2.5KB gzip startup JS). * fix(ui): derive status glows and tints from semantic tokens Status-dot glows, callout gradients, compaction-indicator borders, chip borders, and dreams pulse animations baked literal green/blue/amber/red rgba values -- several stale copies of old --danger/--info hexes -- so they ignored theme families and light mode's deeper status hues. All 22 sites now color-mix over --ok/--warn/--warn-strong/--danger/--info. * fix(ui): scope default accent swatch chip vars to a swatch class Reusing .settings-theme-card--<theme> on the accent swatch made theme-card Playwright locators resolve to two elements (strict-mode violation in the prefs-reconnect e2e suite). The default swatch now uses .settings-accent-theme--<theme>, added alongside the theme-card selectors in the theme-invariant chip var blocks. * fix(ui): carry --primary-hover through the accent override The accent apply path set --primary but not --primary-hover, so dark Claw/Knot primary buttons reverted to the theme hover color while an accent was active (ClawSweeper P2). Derive it from --primary like the accent hover, clear it on reset, and prove the resolved hover color via a painted probe in the appearance e2e.
1 parent c337919 commit 8e6c34f

37 files changed

Lines changed: 872 additions & 183 deletions

‎docs/web/control-ui.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ The Appearance panel has the built-in Claw, Knot, and Dash themes (Claw is defau
153153

154154
Imported themes are stored only in the current browser profile; they are not written to gateway config and do not sync across devices. Replacing the imported theme updates the one local slot; clearing it switches back to Claw if the imported theme was active.
155155

156+
Choose an **Accent color** preset or custom color in Appearance to override the active theme's accent. This preference takes precedence over the operator-configured `ui.seamColor`. **Restore default** clears the preference and restores `ui.seamColor` when configured, or the theme's own accent otherwise.
157+
156158
Appearance also has a Text size setting. It applies to chat text, composer text, tool cards, and chat sidebars, and keeps text inputs at least 16px so mobile Safari does not auto-zoom on focus.
157159

158-
Theme, theme mode, language, and chat display preferences sync through the gateway config (`ui.prefs`), so they follow you across devices and agents can change them through the approval gate — connected clients apply changes live via the gateway's `config.changed` notice. Each browser keeps a local mirror for instant boot. Text size remains browser-local. An explicitly read-only connection applies preference changes only in that browser and does not attempt a config write. Changes made while offline remain queued until a later connection can write config; on a read-only reconnect, they continue to behave as browser-local preferences. See [Configuration reference](/gateway/configuration-reference#ui).
160+
Theme, theme mode, accent color, language, and chat display preferences sync through the gateway config (`ui.prefs`), so they follow you across devices and agents can change them through the approval gate — connected clients apply changes live via the gateway's `config.changed` notice. Each browser keeps a local mirror for instant boot. Text size remains browser-local. An explicitly read-only connection applies preference changes only in that browser and does not attempt a config write. Changes made while offline remain queued until a later connection can write config; on a read-only reconnect, they continue to behave as browser-local preferences. See [Configuration reference](/gateway/configuration-reference#ui).
159161

160162
## OpenClaw system care
161163

‎src/config/__snapshots__/schema.help.quality.test.ts.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ exports[`config tier coverage > keeps the curated common leaf set reviewable 1`]
605605
"tts.providers.*.apiKey.source",
606606
"ui.assistant.avatar",
607607
"ui.assistant.name",
608+
"ui.prefs.accent",
608609
"ui.prefs.chatFollowUpMode",
609610
"ui.prefs.chatPersistCommentary",
610611
"ui.prefs.chatSendShortcut",

‎src/config/config-misc.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,18 @@ describe("ui.seamColor", () => {
518518
});
519519
});
520520

521+
describe("ui.prefs.accent", () => {
522+
it.each([
523+
["lowercase hex", "#ff5c5c", true],
524+
["uppercase hex", "#AbCdEf", true],
525+
["missing hash", "ff5c5c", false],
526+
["invalid hex", "#gggggg", false],
527+
["invalid length", "#ff5c5c00", false],
528+
])("validates %s", (_label, accent, valid) => {
529+
expect(validateConfigObject({ ui: { prefs: { accent } } }).ok).toBe(valid);
530+
});
531+
});
532+
521533
describe("ui.prefs.sidebarEntries", () => {
522534
it("accepts the route and session entries synchronized by the Control UI", () => {
523535
const result = validateConfigObject({

‎src/config/schema.help.agents.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ export const AGENT_FIELD_HELP: Record<string, string> = {
33
ui: "UI presentation settings for accenting and assistant identity shown in control surfaces. Use this for branding and readability customization without changing runtime behavior.",
44
"ui.seamColor":
55
"Primary accent color used by UI surfaces for emphasis, badges, and visual identity cues. Use high-contrast values that remain readable across light/dark themes.",
6+
"ui.prefs.accent":
7+
"User-selected Control UI accent color in #RRGGBB format. Overrides ui.seamColor; clear it to restore the configured seam color or theme default.",
68
"ui.assistant":
79
"Assistant display identity settings for name and avatar shown in UI surfaces. Keep these values aligned with your operator-facing persona and support expectations.",
810
"ui.assistant.name":

‎src/config/schema.labels.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ export const FIELD_LABELS: Record<string, string> = {
711711
"mcp.servers.*.codex.default_tools_approval_mode": "Codex MCP Tool Approval",
712712
ui: "UI",
713713
"ui.seamColor": "Accent Color",
714+
"ui.prefs.accent": "User Accent Color",
714715
"ui.assistant": "Assistant Appearance",
715716
"ui.assistant.name": "Assistant Name",
716717
"ui.assistant.avatar": "Assistant Avatar",

‎src/config/schema.tiers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ tools.media.models.*.request.auth.token tools.profile tools.sessions
159159
tools.web transcripts.enabled
160160
tts.auto tts.persona tts.personas.*.providers.*.apiKey tts.provider
161161
tts.providers.* tts.providers.*.apiKey
162-
ui.assistant.avatar ui.assistant.name ui.prefs.chatFollowUpMode
162+
ui.assistant.avatar ui.assistant.name ui.prefs.accent ui.prefs.chatFollowUpMode
163163
ui.prefs.chatPersistCommentary ui.prefs.chatSendShortcut ui.prefs.chatShowThinking
164164
ui.prefs.chatShowToolCalls ui.prefs.locale
165165
ui.prefs.theme ui.prefs.themeMode update.auto.enabled update.channel

‎src/config/types.openclaw.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ export type OpenClawConfig = {
162162
theme?: "claw" | "knot" | "dash" | "custom";
163163
/** Light/dark preference. */
164164
themeMode?: "light" | "dark" | "system";
165+
/** User-selected Control UI accent color (#RRGGBB). */
166+
accent?: string;
165167
/** BCP 47 UI locale, e.g. "en" or "pt-BR". */
166168
locale?: string;
167169
/** Show model thinking output in chat. */

‎src/config/zod-schema.root-shape.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export const OpenClawSchemaShape = {
229229
themeMode: z
230230
.union([z.literal("light"), z.literal("dark"), z.literal("system")])
231231
.optional(),
232+
accent: HexColorSchema.startsWith("#").optional(),
232233
locale: z.string().max(20).optional(),
233234
chatShowThinking: z.boolean().optional(),
234235
chatShowToolCalls: z.boolean().optional(),

‎ui/docs/design-system/color-tokens.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Light mode uses a warm paper palette: ivory backgrounds, warm gray borders (`#e8
4848
| `--accent-glow` | `rgba(255,92,92,0.2)` | Focus rings, glow effects | Not as background |
4949
| `--primary` | `#d13c3c` | Filled primary buttons (white text, ~4.8:1 AA) | Not interchangeable with `--accent` |
5050

51+
The synced `ui.prefs.accent` preference overrides `ui.seamColor`, which overrides the active theme's default accent. Both overrides update the accent, primary, and focus token families together; `--accent-foreground` and `--primary-foreground` automatically switch between dark and white ink according to the accent's relative luminance. Clearing the preference restores the configured seam color or theme defaults.
52+
5153
## Accent 2 (Teal)
5254

5355
| Token | Value | Use |

‎ui/src/app/app-shell-view.ts‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { canCallGatewayMethod } from "../lib/gateway-methods.ts";
1919
import { readSessionMethodAccess } from "../lib/session-method-access.ts";
2020
import { normalizeAgentId } from "../lib/sessions/session-key.ts";
2121
import { isTerminalAvailable } from "../lib/terminal-availability.ts";
22-
import { findSettingsSearchBlocks } from "../pages/config/settings-search.ts";
2322
import type { NewSessionTarget } from "../pages/new-session/location.ts";
2423
import { pluginTabKey, pluginTabRefFromSearch } from "../pages/plugin/route.ts";
2524
import type { ShellRouteState } from "./app-host-route-state.ts";
@@ -259,15 +258,6 @@ export function renderApplicationShell(host: ShellViewHost) {
259258
// must not reserve its fixed sidebar column (the grid would stay off-center).
260259
const settingsTakeover = isSettingsNavigationRoute(activeRoute) && !host.onboardingMode;
261260
const runtimeConfig = context.runtimeConfig.state;
262-
const settingsSearchBlocks = findSettingsSearchBlocks({
263-
query: host.settingsSearchQuery,
264-
schema: runtimeConfig.configSchema,
265-
value: runtimeConfig.configForm ?? runtimeConfig.configSnapshot?.config ?? null,
266-
uiHints: runtimeConfig.configUiHints,
267-
identityAvailable: Boolean(gatewaySnapshot.selfUser),
268-
basePath: context.basePath,
269-
canAdmin: operatorAccess.canAdmin,
270-
});
271261
const onboarding = host.onboardingMode;
272262
const memoryImportActive = onboarding && activeRoute !== "custodian";
273263
host.lazyCustomElements.requestWhileActive(
@@ -413,7 +403,15 @@ export function renderApplicationShell(host: ShellViewHost) {
413403
onHoldUpdate: () => context.overlays.holdUpdate(),
414404
onReviewUpdate: () => host.navigate("updates"),
415405
searchQuery: host.settingsSearchQuery,
416-
searchBlockMatches: settingsSearchBlocks,
406+
searchParams: {
407+
query: host.settingsSearchQuery,
408+
schema: runtimeConfig.configSchema,
409+
value: runtimeConfig.configForm ?? runtimeConfig.configSnapshot?.config ?? null,
410+
uiHints: runtimeConfig.configUiHints,
411+
identityAvailable: Boolean(gatewaySnapshot.selfUser),
412+
basePath: context.basePath,
413+
canAdmin: operatorAccess.canAdmin,
414+
},
417415
onExit: () => host.exitSettings(),
418416
onRetryConnect: () => context.gateway.connect(),
419417
onNavigate: (routeId, options) => host.navigate(routeId, options),

0 commit comments

Comments
 (0)