Repository navigation
fix(ui): make chat inline code readable on dark themes - #121376
Conversation
Every dark palette defines --secondary with the same hex as --card, so the markdown code chip painted with --secondary collapsed into the surface it sat on (1.00:1 against a user bubble, 1.06-1.08:1 against the flat assistant column) and --border was too close to the background to draw an edge. Light mode never showed the bug because it overrode both properties. Promote the light override into the single canonical rule: code chips and code blocks paint --bg-muted with a --border-strong edge in every theme, and the mode-specific overrides (including the raw rgba border) are deleted. Also fixes the theme-contrast guard, which merged repeated `:root` blocks by overwriting instead of merging, so the default `dark` theme resolved to an empty token map and skipped every assertion. A new case reads the chip tokens out of the shipped rule and asserts surface and border separation from --card and --bg on all six themes.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 11:44 PM ET / August 10, 2026, 03:44 UTC. ClawSweeper reviewWhat this changesThis PR makes Control UI chat inline code and fenced blocks use the muted surface and strong border in every theme, while adding a contrast regression guard. Merge readiness✅ Ready for maintainer review Keep open. Current main still uses the collapsing code-surface tokens; this focused PR replaces them through the shared chat markdown rules and repairs the skipped default-theme guard. No blocking patch defect found; the MEMBER-authored, Priority: P2 Review scores
Verification
How this fits togetherControl UI markdown produces inline flowchart LR
A[Theme palettes] --> B[Shared color tokens]
B --> C[Chat markdown styles]
D[Markdown messages] --> C
C --> E[Inline code and code blocks]
B --> F[Theme contrast guard]
C --> F
F --> G[Regression protection]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -7, Tests +59. Total +52 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one mode-independent chat-code rule using Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: current main paints chat code with Is this the best way to solve the issue? Yes. Promoting the existing light-mode token choice into the single shared markdown rule avoids dark-only duplication and preserves the established custom-theme token contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eab26ec43907. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Every dark palette defines --secondary with the same hex as --card, so the markdown code chip painted with --secondary collapsed into the surface it sat on (1.00:1 against a user bubble, 1.06-1.08:1 against the flat assistant column) and --border was too close to the background to draw an edge. Light mode never showed the bug because it overrode both properties. Promote the light override into the single canonical rule: code chips and code blocks paint --bg-muted with a --border-strong edge in every theme, and the mode-specific overrides (including the raw rgba border) are deleted. Also fixes the theme-contrast guard, which merged repeated `:root` blocks by overwriting instead of merging, so the default `dark` theme resolved to an empty token map and skipped every assertion. A new case reads the chip tokens out of the shipped rule and asserts surface and border separation from --card and --bg on all six themes.
Closes #121374
What Problem This Solves
Fixes an issue where operators on any dark Control UI appearance would see inline code spans and fenced code blocks blend into the surrounding message. The chip had no usable surface step and no visible edge, so commands, paths, and flags in agent replies read as ordinary body text. Light mode was already correct, which is why the defect only ever showed on the default dark families.
Why This Change Was Made
The chat markdown rule painted code surfaces with
--secondaryand--border. Every dark palette inui/src/styles/base.cssdefines--secondarywith the exact hex of--card, so a chip inside a message bubble was a 1.00:1 match with the bubble and only 1.06-1.08:1 against the flat assistant column, while--bordersat at 1.08-1.13:1 against--card. Light mode looked right only becauseui/src/styles/chat/text.cssoverrode both properties for:root[data-theme-mode="light"], choosing--bg-mutedplus a real border.The fix promotes that light override into the single canonical rule instead of adding a second dark-only override: code chips and code blocks now paint
--bg-mutedwith a--border-strongedge in every theme, and both mode-specific overrides (including the rawrgba(0, 0, 0, 0.1)border) are deleted. Dark deliberately lands slightly below light's edge presence, since a bright hairline reads stronger on a dark surface at equal ratio. Custom (shadcn-style) themes benefit too:--bg-mutedmaps to the theme's own muted surface and--border-strongis derived ascolor-mix(in srgb, var(--border) 72%, var(--text) 28%), so both are guaranteed to separate.The change also repairs the guard that should have caught this.
ui/src/styles/base-theme-contrast.node.test.tsoverwrote repeated:rootblocks instead of merging them, andbase.cssdeclares:rootmore than once (palette, then the standalone--cursor-actionblocks). The last tiny block won, so the defaultdarktheme resolved to an empty token map and every assertion for it was silently skipped. With merging restored, a new case reads the chip's surface and border tokens out of the shipped rule and asserts separation from--cardand--bgon all six themes, so swapping the tokens back for a collapsing pair fails in CI.Sibling surfaces were checked and intentionally left alone:
ui/src/styles/sidebar-markdown.cssuses a different, working idiom (rgba(0, 0, 0, 0.12), which darkens against a dark surface and does separate), andui/src/styles/chat/tool-cards.cssdeliberately strips the pill from command and diff<code>used for semantics only.User Impact
Inline code and code blocks in chat are now clearly identifiable as code on Claw dark, OpenKnot dark, and Dash dark, with the same restrained weight light mode already had - a distinct surface and a soft edge, not a loud highlight. Light appearances are visually unchanged. No config, no migration, no opt-in.
Evidence
Measured with the same WCAG relative-luminance math as the contrast guard. Chip surface and border, before -> after:
--card--bg--cardLight chip surfaces are byte-identical (verified by sampling the rendered pixels:
#efebe4before and after). Only the light border moves, from the compositedrgba(0, 0, 0, 0.1)to--border-strong, which is within one or two units per channel on claw-light and openknot-light and slightly firmer on dash-light.Screenshots come from the mock-gateway Control UI E2E harness with fixture messages, captured headless at 1100x900. Each image is the same rendered line at 2x, before on top and after below.
Claw dark - the chip gains a surface step and a soft edge:
OpenKnot dark:
Dash dark:
Claw light - unchanged:
Full message frame on Claw dark after the change, showing an inline chip inside a user bubble, inline chips in the flat assistant column, and a fenced block:
Focused tests, all green:
The new guard was verified to actually fail on the pre-fix tokens rather than passing vacuously:
git diff --checkclean, stylelint clean on the touched stylesheet, oxfmt clean on the touched test. Production LOC delta is -7 (7 added, 14 removed, 3 of the added lines being the invariant comment); the +59 lines are test-only.