Skip to content

refactor(theme): collapse git derived color tokens#1453

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/theme-contract-low-usage-collapse
Jul 7, 2026
Merged

refactor(theme): collapse git derived color tokens#1453
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/theme-contract-low-usage-collapse

Conversation

@limityan

@limityan limityan commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Remove Git diff/status derived background, hover, and border fields from GitColors, theme presets, ThemeService, and static root token exports.
  • Derive Git diff/status backgrounds locally with color-mix() from canonical Git semantic text colors, keeping added, deleted, changes, and intentionally distinct staged text roles.
  • Prune non-contract colors.git custom-theme keys during normalization, migrate legacy persisted custom themes on load, and keep exported themes aligned with the current Git color contract.
  • Lower the theme governance baseline and update docs/architecture/theme-token-optimization.md so this contraction is captured as a durable contract rule.

Metrics

Metric Before After
Web UI color occurrences 486 479
Web UI unique colors 306 302
Static root contract keys 250 242
Runtime contract keys 102 94
Static low-external root keys 51 44
Theme preset occurrences / unique colors 168 / 115 167 / 114
Token contract occurrences / unique colors 90 / 80 84 / 76
App UI raw / fallback / unresolved / non-contract vars 0 / 0 / 0 / 0 0 / 0 / 0 / 0

Risk Review

  • Kept staged as a separate Git text role because Tokyo Night intentionally differentiates staged and added states; inline added diff lines now read --git-color-added, so they are not visually mislabeled as staged.
  • Existing custom themes that still contain old Git derived fields such as changesBg, addedBg, deletedBg, stagedBg, addedBgHover, stagedBorder, or pull continue to load, but colors.git is normalized to the closed Git contract before persistence/export.
  • Git diff/status backgrounds now derive at consumption sites from the active theme's canonical Git colors, avoiding duplicated TS/Sass/runtime definitions while preserving visible status semantics.
  • Independent subagent review was run from both architecture and product-design perspectives; the identified custom-theme persistence/export gap was fixed and re-reviewed with no remaining blockers.

Related: #1197

Verification

  • pnpm run theme:color-audit:all
  • pnpm run theme:visual-contract
  • pnpm --dir src/web-ui run test:run
  • pnpm --dir src/web-ui run test:run src/infrastructure/theme/core/ThemeService.test.ts
  • pnpm run theme:color-audit:test
  • pnpm run type-check:web
  • pnpm run lint:web (passes with existing bitfun-canvas warnings only)
  • pnpm run build:web (passes with existing Vite chunk/dynamic-import warnings only)
  • git diff --check

@limityan
limityan force-pushed the yanzhn/theme-contract-low-usage-collapse branch from 05c446a to cc00e4d Compare July 7, 2026 09:03
@limityan
limityan merged commit 487834a into GCWing:main Jul 7, 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