Skip to content

refactor(theme): align tokens, token-ize hardcoded colors, clean up legacy#1186

Merged
limityan merged 2 commits into
GCWing:mainfrom
limityan:refactor/theme-token-cleanup
Jun 13, 2026
Merged

refactor(theme): align tokens, token-ize hardcoded colors, clean up legacy#1186
limityan merged 2 commits into
GCWing:mainfrom
limityan:refactor/theme-token-cleanup

Conversation

@limityan

@limityan limityan commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Systematic theme token cleanup across Web UI, Mobile Web, and Installer — 7 phases ordered by increasing scope, each independently verifiable.

Changes by Phase

P1: Mobile Web token name fix (1 file)

  • sessions.scss: Fix references to non-existent --color-error-500/50/100 tokens → --color-error / --color-error-bg

P2: CodeReviewToolCard fallback unification (1 file)

  • Unify all var() fallback values to match dark-theme.ts: success→#34d399, warning→#f59e0b, error→#ef4444, info→#a1a1aa
  • Fix --color-danger (never defined) → --color-error

P3: TurnHistoryPanel token-ization (1 file)

  • Replace ~35 hardcoded Tailwind grays with design tokens
  • Delete entire @media (prefers-color-scheme: dark) block (213→135 lines)

P4: Installer variables.css completion (1 file)

  • Add 13 missing tokens (bg-tertiary/elevated/workbench, purple series, warning/info/highlight, border-prominent, etc.)
  • Align old fallback values to match bitfun-dark runtime theme

P5: tokens.scss ↔ dark-theme.ts alignment (1 file)

  • Align 34 SCSS fallback properties to match dark-theme.ts runtime values
  • Eliminates theme flash on initial load (SCSS fallbacks now match runtime values)
  • Update git color system to match dark-theme.ts git colors

P6: Bulk hardcoded color token-ization (20 files)

  • Token-ize ~130+ bare hardcoded colors across 20 component files
  • Maps GitHub-style semantic colors to design tokens (--color-success, --color-error, --color-warning, --color-accent-*, --git-color-*)
  • Remove @media (prefers-color-scheme: dark) blocks from TurnRollbackButton, TurnHistoryPanel

P7: Legacy cleanup (1 file)

  • Remove unused $color-gray-* series (9 SCSS vars + 9 CSS var injections, zero references)
  • Remove orphaned $button-text-default (zero references)

Additional fixes found during adversarial review

  • Fix --color-text-disabled misused as button background → opacity: var(--opacity-disabled)
  • Fix --color-scrollbar-thumb wrong variable name → --scrollbar-thumb (pre-existing bug)
  • Fix --shadow-sm fallback value mismatch
  • Fix --color-danger-600 / --color-error-600 / --color-error-alpha / --color-error-rgb references (pre-existing undefined tokens)
  • Fix InlineDiffPreview light theme gutter using dark-only hover variants

Cross-product impact

  • Mobile Web: Independent theme system, only P1 touches it (1 token name fix)
  • Installer: Independent theme system, only P4 touches it (fallback completion)
  • Desktop: Has its own Rust theme.rs bootstrap, not affected by tokens.scss changes
  • CLI / Relay Server: No CSS involvement

Verification

  • pnpm run type-check:web — 0 errors
  • pnpm run lint:web — 0 errors (3 pre-existing warnings unrelated)
  • pnpm --dir src/mobile-web run type-check — 0 errors
  • pnpm --dir BitFun-Installer run type-check — 0 errors
  • 12 theme/layout unit tests passed (ThemeService, SessionsSectionLayout, ChatInputWorkspaceStripLayout, NavPanelLayout)
  • No E2E tests assert specific color values or CSS variable values

limityan added 2 commits June 13, 2026 18:43
InlineDiffPreview used fixed-height virtualization rows (22px) while CSS
allowed text wrapping (pre-wrap). Wrapped content beyond 22px was hidden
by overflow:hidden, making long diff lines unreadable.

Changes:
- Switch virtualizer to dynamic measurement (measureElement) so wrapped
  rows report their real height instead of a fixed 22px estimate
- Add ResizeObserver to invalidate cached measurements when the container
  width changes (wrapping depends on width)
- Add content truncation for very large diffs (500 lines / 50k chars)
  with head+tail preview and a visible truncation notice
- Remove overflow:hidden on diff-line__content; use overflow-wrap:anywhere
- Apply measureElement ref to context-separator rows for measurement
  consistency
…egacy

Phase P1-P7 theme token system cleanup across Web UI, Mobile Web, and Installer:

P1: Fix Mobile Web sessions.scss referencing non-existent --color-error-* tokens
P2: Unify CodeReviewToolCard fallback values and fix --color-danger → --color-error
P3: Token-ize TurnHistoryPanel (~35 hardcoded Tailwind grays), remove @media dark block
P4: Complete Installer variables.css with 13 missing tokens, align fallbacks to bitfun-dark
P5: Align tokens.scss SCSS fallbacks with dark-theme.ts runtime values (34 properties)
P6: Token-ize ~130+ hardcoded colors across 20 component files (semantic colors → tokens)
P7: Remove unused legacy -gray-* series and orphaned -text-default

Additional fixes found during review:
- Fix --color-text-disabled misused as background (→ opacity-disabled)
- Fix --color-scrollbar-thumb wrong variable name (→ --scrollbar-thumb)
- Fix --shadow-sm fallback mismatch
- Fix --color-danger-600/--color-error-600/--color-error-alpha/--color-error-rgb references
- Fix InlineDiffPreview light theme gutter using dark-only hover variants

Verified: type-check 0 errors, lint 0 errors, 12 theme/layout tests passed
@limityan limityan merged commit 0c3d7b4 into GCWing:main Jun 13, 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