Skip to content

feat(tui): add automatic light theme selection - #1217

Open
TheGreatAxios wants to merge 2 commits into
mainfrom
cl-8993-light-palette
Open

TheGreatAxios wants to merge 2 commits into
mainfrom
cl-8993-light-palette

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds contrast-checked light and dark terminal roles that keep assistant prose, markdown, thinking, tool details, lockup chrome, expanded MCP tables, and diff rows readable on their actual truecolor and ANSI-256 surfaces.
  • Selects the final theme before constructing renderables with precedence: explicit setting, COLORFGBG, synchronous OS appearance, then dark fallback.
  • Resolves lockup and MCP styles at paint time, maps MCP warning and danger tones to the shared warning and error roles, invalidates cached syntax styles by theme, and removes unsupported OSC and post-mount partial repaint paths.
  • Keeps semantic palette role objects stable across theme changes with truthful keys, entries, descriptors, and frozen-record reads.
  • Uses muted-plum light warning #655275: 5.86:1 on #f7ead5, with CIE76 distances 48.07/53.97 from in-flight roles, 49.46 from heading, and 59.23 from error.

Verification

  • bun run check passes with 8,630 tests across 553 files.
  • bun test src/tui/lockup.test.ts src/tui/mcp-view.test.ts tests/unit/tui/theme.test.ts passes all 46 focused tests without forcing COLORTERM.
  • Real captured light-theme spans verify the rendered lockup and every expanded MCP table tone against their captured backgrounds at >=4.5:1; the MCP test also verifies coherent dark warning/error rendering.
  • The truecolor/ANSI-256 × light/dark matrix verifies every essential foreground on its actual base or tinted surface at >=4.5:1.
  • Dark diff removal is #ef766a on #3d2a28 at 4.79:1 and ANSI 203 on 52 at 4.75:1; dark ANSI added is 151 on 22 at 4.99:1, text on pending is 252 on 24 at 4.56:1, and text on success is 252 on 22 at 5.16:1.
  • Light ANSI success is 22 on surface 230 at 7.79:1 and on added background 194 at 7.27:1. Brand/accent/live remain distinct at 94/60/58; dark brand/accent/live are 173/74/110.
  • The PR contains 21 files: the prior 17-file light-theme change plus four causal lockup/MCP implementation and rendered-test files.

Fixes CL-8993

@linear-code

linear-code Bot commented Sep 28, 2026

Copy link
Copy Markdown

CL-8993

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critic review — exact head 72253d8b62fe9ed3a95b84b0ee84e87425ee9414

Verdict: no residual blockers; ready to merge from the behavioral/correctness review lane.

Historical blocker map:

  • Closed: no eager production module-init UI/semantic color snapshots. An AST probe over all production src/tui/**/*.ts found none; lockup ramps are deferred closures, MCP tones resolve through live UI roles, and prompt/markdown native style caches are keyed by UI.name.
  • Closed: rendered contrast and dynamic styling. Focused renderer tests passed for lockup and MCP; MCP warning/error/status tones rendered in both light and dark at >=4.5:1. Stream/diff/tool detail roles resolve after theme selection, and a direct dark-to-light prompt cache probe rendered #8f4f16 as the light action color.
  • Closed: semantic palette behavior. Direct probes verified stable palette and entry identity, truthful Object.keys/Object.entries/property descriptors, and continued nested entry updates after Object.freeze(palette).
  • Closed: truecolor and ANSI-256 coverage, warning hierarchy, and shared MCP warning/error semantics. The contrast matrix and hierarchy tests pass; MCP/plugin attention uses warning, meter 61–80 warning, and 81–100 error.
  • Closed: startup selection and OSC claims. runTUI resolves and applies the theme before session preparation and host mount; production has no OSC 11 query, and docs/TUI.md accurately says so.
  • Closed: causal scope. The two-commit diff is limited to theme settings/detection, TUI palette consumers, tests, and TUI documentation.

Evidence:

  • Focused review run: 168 passed, 0 failed across lockup, MCP, palette, theme, stream, diff, diff rows, and shell tests.
  • Canonical bun run check in a clean isolated exact-head checkout: lint/typecheck/dead exports/build passed; guarded suite 8,630 passed, 0 failed.
  • Current PR head still matches the reviewed SHA; GitHub checks are green (the optional one-process pollution detector is skipped in CI, while the local canonical one-process suite passed).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant