Skip to content

refactor(theme): derive CLI truecolor fallbacks from presets#1407

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/theme-token-key-consolidation
Jul 3, 2026
Merged

refactor(theme): derive CLI truecolor fallbacks from presets#1407
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/theme-token-key-consolidation

Conversation

@limityan

@limityan limityan commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make CLI truecolor dark/light defaults resolve from the built-in OpenCode-compatible preset JSON instead of a duplicate Rust RGB palette.
  • Preserve partial external OpenCode theme fallback behavior by resolving missing fields against the current base theme.
  • Tighten consumed CLI preset colors after product review: light diff foregrounds and line numbers now reuse stronger existing roles, light warning uses one darker amber seed, dark diff line numbers reuse muted text, and command prompts follow primary for block/hover readability.
  • Update the theme optimization document and CLI governance baseline to keep Rust/TS ownership clear: TS owns theme preset data, CLI owns terminal projection and ANSI/monochrome fallback behavior.

Metrics

Metric Before After
CLI Rust fallback Color::Rgb occurrences 44 0
CLI Rust fallback unique colors 32 0
CLI total unique colors 148 114
CLI runtime unique colors 107 75
CLI preset unique colors 118 114
CLI runtime preset unique colors 77 75

User-visible CLI Color Changes

Mode Key colors before Key colors after
Dark truecolor default primary #3b82f6, background #111827, panel #1e2637, diff line #66666d primary #60a5fa, background #0e0e10, panel #1c1c1f, diff line #858585
Light truecolor default primary #2563eb, background #f9fafb, panel #f0f2f5, warning #c08c42, diff added/removed/line #4f8f64/#b85454/#94a3b8 primary #475569, background #f3f3f5, panel #ffffff, warning #9a651f, diff added/removed/line #3f7d54/#9f4444/#64748b

ANSI16 and monochrome paths are unchanged. Command prompt color now follows primary so it remains readable on command card block and hover backgrounds.

Review Fixes

  • Independent architecture and product-design subagent review found that removing generated-widget --btn-* payload would degrade Cyber/Tokyo/light button identity inside iframe content.
  • That attempted payload compression was reverted. Generated-widget payload remains at 80 keys with 18 resolved button tokens, and the document now records why those button tokens stay in the payload boundary.
  • Product-design review also flagged that CLI truecolor changes affect diff/status/command/muted roles, not only primary/background/panel. This update adds role-level contrast coverage and improves the weakest consumed truecolor roles without expanding the palette.
  • Final architecture review found the command prompt contrast guard was checking the wrong background; command text now derives from primary and the guard covers block and hover block backgrounds.

Verification

  • pnpm run theme:color-audit:all
  • pnpm run theme:color-audit:test
  • pnpm run theme:visual-contract
  • pnpm --dir src/web-ui run test:run -- themePayload.test.ts
  • pnpm run type-check:web
  • pnpm run lint:web
  • cargo test -p bitfun-cli theme -- --nocapture
  • cargo check -p bitfun-cli
  • git diff --check

AI-assisted; locally verified as listed above. Cargo verification only reported existing rmcp deprecation warnings.

@limityan
limityan force-pushed the yanzhn/theme-token-key-consolidation branch from c346089 to b3c9fd5 Compare July 3, 2026 10:59
@limityan limityan changed the title refactor(theme): compress widget payload and CLI fallbacks refactor(theme): derive CLI truecolor fallbacks from presets Jul 3, 2026
@limityan
limityan force-pushed the yanzhn/theme-token-key-consolidation branch from b3c9fd5 to 7b5e615 Compare July 3, 2026 11:12
@limityan
limityan force-pushed the yanzhn/theme-token-key-consolidation branch from 7b5e615 to 3112860 Compare July 3, 2026 11:22
@limityan
limityan marked this pull request as ready for review July 3, 2026 15:51
@limityan
limityan merged commit 912cd75 into GCWing:main Jul 3, 2026
4 checks 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