Skip to content

fix(theme): built-in color pairs meet WCAG AA and dark-mode surfaces stay themed - #36561

Merged
nwparker merged 1 commit into
mainfrom
nwparker/theme-contrast-defaults
Nov 1, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/theme-contrast-defaults

Conversation

@nwparker

@nwparker nwparker commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59
Prod 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15

Summary

Fixes several built-in theme defaults. Most of them are single token changes in main.css, so every surface that uses the token gets the fix. No per-component overrides.

Issue Root cause Fix
#25533 --destructive-foreground was close in luminance to --destructive in both themes (dark mode put a dark red on a light red). Light mode uses #fff. Dark mode uses deep-red ink #450a0a on the light-red --destructive.
#25569 --muted-foreground and light --status-success sat just under AA on common surfaces. Light --muted-foreground #737373 → #696969. Dark --muted-foreground #a1a1a1 → #acacac. The surfaces (--muted, --accent, hover, focus border) stay as they are. Light --status-success #15803d → #147638.
#25561 Placeholders added /40–/70 alpha on top of --muted-foreground, which is already the de-emphasized tier (STYLEGUIDE: "muted = … placeholders"). Every placeholder:text-muted-foreground/NN (24 sites, including the Input/Textarea primitives) is now placeholder:text-muted-foreground.
#18327 The real cause: the document never declared color-scheme. Chromium therefore drew every unstyled native scrollbar and form control in its light default, even in dark mode. color-scheme: light / color-scheme: dark now sit in the existing per-scheme token blocks (:root / .dark, plus the native-chat scheme selectors). Every native scrollbar, <select>, checkbox and similar control now follows the mode. The non-virtualized TOC list also uses scrollbar-editor, like its virtualized sibling already did.
#16283 The active tab "lifted" by mixing 6% foreground into --card. That lightens in dark mode but darkens in light mode, because white --card can't get lighter. So in light mode the selected tab looked recessed. New --tab-active / --tab-inactive tokens (bg-tab-active / bg-tab-inactive). Dark mode is unchanged. Light mode keeps the active tab on --card (white, connected to the content) and recesses the inactive tabs by 4%. The token names match the ones the in-flight public tab-bar theme tokens use, so the two changes merge cleanly.

Cleanup that this makes possible:

  • Removed the hard-coded color-scheme: dark on .popover-scroll-content. It was wrong in light mode; those popovers now inherit the root scheme.
  • The plugin panel / custom-editor shell now declares color-scheme from its html.light|dark class (zero-specificity :where(), so plugins can still override it). Without this, the frame document (normal) would mismatch the now-dark iframe element, and Chromium would paint an opaque light backdrop behind plugins that leave body transparent. Plugin scrollbars and controls now follow the mode too (proof below).
  • Mobile mirrors of the desktop tokens (textSecondary, textMuted, statusGreen, plus a new onStatusRed for --destructive-foreground) and the docs-site copy of the palette are updated to the same values. Mobile native-chat visual frames now send --muted-foreground from textSecondary, the mobile mirror of desktop --muted-foreground; before, they sent the fainter textMuted. They also send --destructive-foreground from onStatusRed instead of white. Before, dark --destructive-foreground on --destructive was #fff on #ff6568 (2.87:1).

Supersedes / builds on #25534 and #25562 by @matbrgz (destructive pair and placeholder fixes), #18328 by @CodeHourra and #25636 (TOC scrollbar; this PR fixes the document-level root cause as well), and #16481 by @BorjaLL (light active-tab surface; same idea, done as tokens).

Closes #25533
Closes #25569
Closes #25561
Closes #18327
Closes #16283
Refs #10782 (fixes the at-a-glance active/inactive distinction in light mode; the keyboard/motion/close-control parts of that proposal are out of scope)

Contrast, before → after

Measured as WCAG 2.x ratios in the running app, from computed colors with translucent layers composited (the swatch screenshots below).

Theme Pair Before After
Light --destructive-foreground on --destructive 4.47 4.87
Dark --destructive-foreground on --destructive 1.66 5.62
Light muted-foreground on muted / accent (#f5f5f5) 4.35 5.04
Light muted-foreground on background (#fff) 4.74 5.49
Light muted-foreground on worktree-sidebar accent (#eaeaea) 3.94 4.56
Dark muted-foreground on accent (hover rows/menus) 4.01 4.57
Dark muted-foreground on muted 5.86 6.67
Light status-success on its 10% tint over #fff 4.37 4.94
Light status-success on its 10% tint over muted 4.04 4.57
Light Input placeholder on the field 2.30 5.49
Dark Input placeholder on the field (bg-input/30) 3.36 8.08

The new src/renderer/src/assets/theme-token-contrast.test.ts reads main.css and fails if any of these token pairs drops below 4.5:1 again. It reuses contrastRatio from the plugin theme contrast gate.

Visual proof

These are from the real app: a dev build on a throwaway profile, driven over CDP.

Token swatches, light (before / after). These are rendered with the live tokens and the shipped Input classes.
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

Token swatches, dark (before / after)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

Light tab strip (before / after). README.md is the active tab.
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

Dark tab strip, after. Unchanged from before: computed active #242424, inactive #171717.
(screenshot removed: contained real product data)

Plugin frame in dark mode. Left: shell without the new rule (opaque white mismatch backdrop). Right: with it (transparent, dark native scrollbar).
(screenshot removed: contained real product data)

Scrollbar

Each scenario has one BEFORE image (origin/main ee44140fb9b) and one AFTER image (this PR, 4d713f16a24). Both come from the same dev build launch flow, profile, window size, crop and scroll position, and both are zoomed 2x (nearest-neighbour), so tabbing between the pair shows only the change. The popover list and textarea are probe elements rendered in the app with the shipped classes: an unstyled popover-scroll-content list, and the raw settings textarea classes from RepositoryHookScriptSetting.

Measured gutter width (offsetWidth - clientWidth) is the same or smaller everywhere. TOC: 15px before, 11px after. Popover list and textarea: 15px before and after. With macOS overlay scrollbars, all of them are 0px and fade out the same way.

TOC, light Before: unstyled 15px native scrollbar with a track. After: scrollbar-editor (11px, no track), matching the large-document TOC and the editor beside it.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

TOC, dark Before: a white 15px track in dark mode. After: thin and trackless.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

Popover list, light Before: color-scheme: dark was hard-coded, so light popovers got a dark scrollbar. After: it follows the light scheme.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

Popover list, dark Unchanged; it was already dark.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

Textarea, dark Before: a white native scrollbar. After: it follows the dark scheme. Same width.

(screenshot removed: contained real product data)

(screenshot removed: contained real product data)

Merge-risk assessment

Low (was low–medium). The phase 2 checks below were run by the WS-tokens workstream on behalf of this PR.

  • Computed-style diff versus this PR's base on macOS, built-in light and dark. The scenario covered 14 states: Monaco diff (inline and side-by-side), conflicts, explorer and SCM, title bar, floating terminal header, and the left sidebar in default, Tinted and Match terminal modes. The DOM was identical, and every color difference is accounted for by the intended changes: the light/dark --muted-foreground shift (and everything mixed from it, such as placeholders and icons), and the light tab swap.
  • Windows (awin) and Linux (omarchy, Hyprland/Wayland). The root custom-property deltas are identical to macOS on both platforms.
  • Plugin panel color-scheme. A real sandboxed-ui panel was loaded on Windows and Linux. Before, the frame's :root reported color-scheme: normal in both modes, and on Windows in dark mode the panel's default text rendered black on the dark sidebar, which is unreadable. After, it reports light / dark matching the host, and the text is light in dark mode. The component fixture shows native inputs and selects going dark in dark mode.

Plugin panel on Windows, dark mode. Left: before this PR, black default text. Right: after, light text.
panel windows dark

  • Scrollbar width and weight. In the running app (macOS, classic scrollbars), I measured the gutter of every scrollable element in an open markdown editor view, plus probe elements for the unstyled list, popover-scroll-content and <textarea> cases, with the root color-scheme on and off, in both themes: no width changes. color-scheme only recolors native scrollbars; it never changes their gutter. The one class change (TOC scrollbar-editor) makes that scrollbar narrower (15px to 11px), not wider. Also checked a bare Electron probe on the same Electron version, with macOS overlay scrollbars forced (-AppleShowScrollBars WhenScrolling). Every variant takes 0px and fades after scrolling, so overlay-scrollbar Macs see no difference in width. Native chat already set color-scheme inline, so its scrollbars do not change.
  • Published themes. I loaded all 12 stablyai/orca-plugins app themes before and after this PR. 0 tokens were dropped either way. The only visible change is the light-mode tab swap, which also applies to light plugin themes, because the tab colors chain from the theme's --card.
  • Blast radius: wide, because these are global tokens used across the whole renderer. Each value shift is small and stays in the same hue.
  • color-scheme: the one behavioral change is that native controls and scrollbars now render dark in dark mode. That is intended. Every Orca-owned iframe now declares a scheme that matches the root (plugin shell via the new rule, notebook output and native-chat visual frames already did). So no frame gains Chromium's opaque mismatch backdrop. Before, plugin panels and notebook output mismatched in dark mode.
  • No migrations or settings changes. The new --tab-active / --tab-inactive custom properties are internal, not part of the plugin theme schema.
  • Plugin themes: they still override --muted-foreground etc. through the existing contrast gate. Only the built-in fallbacks moved.
  • Remote / mixed versions: these are renderer-only CSS/TS changes. Nothing changes in protocol or persistence.
  • Perf: none (static CSS values).

Perf

Perf-scan of the diff against ee44140fb9b: the PR changes only static CSS values, class names and two color-scheme declarations. It adds no JS, subscriptions, listeners, timers, IPC or storage work, so scan questions 1–6 (unused work, owner fan-out, thread/storage cost, growth, host cost, teardown) don't apply. The only runtime paths it touches are style recalculation on a theme switch and scrollbar painting.

These measurements come from a dev build on macOS (Apple Silicon) in the background, read through CDP Performance.getMetrics. Base and PR ran on the same profile and the same open view (markdown file with the TOC open, 1044 elements). Base and PR were each launched once, with two measurement runs per launch.

Measurement Base ee44140fb9b PR 4d713f16a24
Style recalc per theme switch (median of 8 × 10 light↔dark switches; 2 runs) 35.2 / 35.1 ms 32.6 / 32.4 ms
Forced synchronous theme flip + layout (p50 / p90, 40 flips) 8.2–8.6 / 10.8–12.2 ms 8.3–8.4 / 9.5–10.5 ms
TOC scroll, 120 frames (p50 / p95 frame time, light and dark) 16.6–16.7 / 17.5–17.6 ms 16.7 / 17.5–17.6 ms
Style recalc / layout during TOC scroll 0 / 0 ms 0 / 0 ms
main.css source size 103,038 B 103,638 B (+600 B)
audit:perf (oxlint perf config) on changed TS/TSX 0 findings 0 findings

Result: no measurable regression. The differences are within run-to-run noise. color-scheme is inherited, so a theme switch already restyles the whole tree.

Negative user-facing tradeoffs

  • Muted/secondary text is slightly darker in light mode and slightly brighter in dark mode, so the hierarchy between primary and secondary text is a little flatter (dark fg/muted ratio goes from 2.48 to 2.17).
  • Placeholders are now as prominent as other muted text. Some fields used a very faint /40–/50 placeholder on purpose (Linear issue/project titles, AI vault filter); those now read stronger.
  • Dark destructive labels that use --destructive-foreground are now dark ink on light red instead of red on red. The shipped Button/Badge destructive variants use text-white, so they are unaffected.
  • In light mode, inactive tabs are now a faint gray (#f5f5f5) while the empty part of the strip stays white. Light plugin themes get the same treatment: the inactive tab is 4% foreground mixed into the theme's --card.
  • Native <select> dropdowns, checkboxes, date pickers and unstyled scrollbars now look dark in dark mode. Anyone used to the light versions will notice. Unstyled native scrollbars in dark mode keep their 15px gutter and now show it as a dark gray track lane instead of a white one.
  • The small-document TOC scrollbar thumb is a faint gray (rgba(121, 121, 121, 0.4), same as the editor scrollbar) instead of Chromium's light thumb on a white track. It is less prominent in dark mode than before.
  • The light success green is a touch deeper.
  • Plugin panels that set no colors of their own now get Chromium's dark defaults in dark mode: light default text on a transparent, dark-backed frame, and dark native controls. Before, they got black text on an opaque white backdrop. Plugins that paint their own colors are unaffected.

Validation

  • pnpm tc: pass.
  • pnpm test: theme-token-contrast.test.ts (new), plugin-panel-shell.test.ts, plugin-frame-api.test.ts, native-chat-appearance-palette.test.ts, document-theme.test.ts, IpynbRendering.test.tsx, BrowserTab.test.tsx, EditorFileTab.test.tsx, TabBarCreateEntry.search.test.tsx, AgentSkillSetupPanel.test.tsx: all pass.
  • Mobile vitest (src/theme, src/session/native-chat/visual): 37/37 pass. Mobile tsc --noEmit: clean.
  • oxlint on changed TS/TSX: clean. oxfmt --check: clean.
  • In the app (light + dark), with a dev build in the background (ORCA_BACKGROUND_LAUNCH=1, CDP, throwaway profile) and a git repo containing a 40-section markdown file:
    • Opened a .ts tab and a .md tab in the rich editor with the TOC open.
    • Checked computed color-scheme on :root: normal before; light/dark after.
    • Checked the TOC scrollbar with and without the utility class.
    • Checked computed tab backgrounds (light: active #fff, inactive #f5f5f5; dark: unchanged).
    • Measured every pair in the table above from computed styles.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 423b94c1-d127-4d55-a68b-0e8d01611865
Commits

Reviewing files that changed from the base of the PR and between 52e557e and 4d713f1.

Files selected for processing: 2
  • mobile/src/theme/mobile-theme.ts
  • src/renderer/src/assets/main.css
Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/assets/main.css

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

Theme colors change in the web, mobile, and documentation interfaces, with new contrast checks for selected token pairs. Input and textarea placeholders now use the full muted foreground color. Tab backgrounds use theme tokens, and the table-of-contents list adds the editor scrollbar class.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 4d713

The theme and interface updates are supported by the inspected source paths, with no actionable merge-blocking risk established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main changes: WCAG AA color-pair fixes and themed dark-mode surfaces.
Linked Issues check Passed Requirements met [#25533, #25569, #25561, #16283, #18327]:
- [#25533] Light --destructive-foreground is #fff on --destructive #e40014 (4.87:1). Dark --destructive-foreground is #450a0a on …
Out of Scope Changes check Passed All changed areas connect to a linked issue or to a direct consequence of one:
- Token value changes in main.css and the new --tab-active / --tab-inactive tokens: needed for [#25533, #25569, #16…
Description check Passed The description is complete and relevant. It explains the user impact, root causes, fixes, linked issues, visual proof, testing, contrast results, performance, compatibility, tradeoffs, and merge risk…
Full details: Linked Issues check

Explanation

Requirements met [#25533, #25569, #25561, #16283, #18327]:

  • [#25533] Light --destructive-foreground is #fff on --destructive #e40014 (4.87:1). Dark --destructive-foreground is #450a0a on #ff6568 (5.62:1). Both exceed 4.5:1. theme-token-contrast.test.ts checks these pairs. The shipped Button and Badge variants use text-white, which the issue already notes.
  • [#25569] Light --muted-foreground #696969 on --muted and --accent #f5f5f5 (5.04:1). Dark --muted-foreground #acacac on --accent #404040 (4.57:1). Light --status-success #147638 on its 10% tint over #fff (4.94:1) and over --muted (4.57:1). The issue requests token-level changes. The PR changes tokens only, and the new test covers these pairs.
  • [#25561] placeholder:text-muted-foreground/NN is replaced by placeholder:text-muted-foreground in ui/input.tsx, ui/textarea.tsx, and the explicit call sites. Reported placeholder ratios are 5.49:1 (light) and 8.08:1 (dark).
  • [#16283] Light active tab uses --tab-active (--card, white). Inactive tabs use --tab-inactive (4% foreground over --card, #f5f5f5). The selected tab is now the lighter tab in light mode. Dark mode values are unchanged.
  • [#18327] The non-virtualized TOC list in MarkdownTableOfContentsPanel.tsx now has scrollbar-editor. The virtualized sibling already uses this class. The PR reports a measured result after the change: 11px gutter (15px before), no track, and a themed thumb in both modes. The current PR description no longer claims the TOC still shows the native scrollbar, so the earlier FAIL basis no longer applies. The issue names scrollbar-sleek as one fix. The issue's expected behavior is a thin, theme-aware scrollbar with a transparent track. The PR does not use scrollbar-sleek, but the PR evidence shows the expected behavior.

Uncertainty: I did not read the scrollbar-editor rule. Its definition is not in scrollbar-sleek.css, and the main.css read was truncated. The #18327 result rests on the PR's reported measurements and the shared class, not on an independent read of the rule. The incremental diff from the previous reviewed head was unavailable, so the changes since the previous review were judged from the whole-PR summary and the current description.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to a linked issue or to a direct consequence of one:

  • Token value changes in main.css and the new --tab-active / --tab-inactive tokens: needed for [#25533, #25569, #16283].
  • Placeholder class changes in ui/input.tsx, ui/textarea.tsx, and the explicit call sites in settings, right-sidebar, Linear, automation, and native-chat components: the placeholder defect in [#25561].
  • drop-indicator.ts tab classes: the tab surface change for [#16283].
  • MarkdownTableOfContentsPanel.tsx scrollbar-editor: the TOC change for [#18327].
  • color-scheme on :root / .dark, the native-chat schemes, and the removed .popover-scroll-content dark scheme: the root-cause fix for [#18327]. This root fix also changes native form controls and plugin panel defaults, which the issue does not name. The PR discloses these effects, and they follow from the same missing color-scheme declaration, so they are not shown to be unrelated.
  • plugin-panel-shell.ts color-scheme rule: keeps the plugin frame scheme equal to the root scheme after the root change.
  • Mobile palette mirrors (mobile-theme.ts, mobile-theme-contrast.test.ts, mobile-native-chat-visual-theme.ts) and the docs-site globals.css palette: they copy the same desktop token values, so they keep palette parity with [#25533, #25569]. These are the weakest links to an issue, but they are not unrelated.
  • theme-token-contrast.test.ts: supporting test for the contrast objectives in [#25533, #25569].

No changed area is shown to be unrelated to the linked issues. The broader native-control change is the main scope judgment. It is a disclosed consequence of the chosen root-cause fix for [#18327].

Full details: Description check

Explanation

The description is complete and relevant. It explains the user impact, root causes, fixes, linked issues, visual proof, testing, contrast results, performance, compatibility, tradeoffs, and merge risk. It does not reproduce every template heading or checklist item, but the required information is present, so the missing headings are non-critical.

Full details: Docstring Coverage

Explanation

Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 21 functions across 27 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment