Skip to content

Theme the diff panel from app theme tokens (Layer 1)#286

Merged
SawyerHood merged 1 commit into
mainfrom
bb/fix-diff-panel-theme-thr_adkx7wh5tb
Jun 20, 2026
Merged

Theme the diff panel from app theme tokens (Layer 1)#286
SawyerHood merged 1 commit into
mainfrom
bb/fix-diff-panel-theme-thr_adkx7wh5tb

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

What

The diff panel renders with @pierre/diffs, which drew its surface, gutter, line numbers, and +/- row tints from fixed light/dark defaults (white/black background, generic green/red). So the diff panel ignored the built-in palettes and the custom CLI stylesheet entirely.

This bridges the library's --diffs-* CSS variable inputs to the existing app theme tokens in theme.css:

@pierre/diffs input app token
--diffs-{light,dark}-bg --background
--diffs-{light,dark} (line fg) --foreground
--diffs-{light,dark}-addition-color --diff-added
--diffs-{light,dark}-deletion-color --diff-removed

Line numbers, context tints, separators, and the +/- row fills all derive from bg/fg inside the library, so bridging those four inputs per mode is enough. Because the built-in palettes and the custom stylesheet already override those app tokens, the diff panel — and the shared file preview, which uses the same --diffs-* path — now follow every theme with no per-palette work.

Light/dark inputs are declared in both the :root, .light and .dark blocks because custom-property var() substitution resolves at the declaring element; declaring only on :root would bake the light value and inherit it into .dark.

Scope / follow-up

Syntax-highlighting token colors (keywords/strings/comments) are unchanged — still the library's fixed pierre-light/pierre-dark Shiki palette. Theming those is a larger follow-up (a CSS-variables Shiki theme mapped to --ansi-*, registered in the diff worker).

Preview

Adds a Ladle story GitDiffCard.stories.tsx with a palette picker rendering a sample patch in light and dark side by side. Verified visually across palettes (Catppuccin, Gruvbox) — surfaces, gutters, line numbers, +/- tints, and the stat tallies all retint to the active palette.

Tests

  • turbo run typecheck --filter=@bb/app
  • theme.test.ts (17 tests) ✅ — new tokens use var(), so they're invisible to the neutral-ramp and oklch-transparency guards.

🤖 Generated with Claude Code

The @pierre/diffs renderer drew its surface, gutter, line numbers, and
+/- row tints from fixed light/dark defaults (white/black bg, generic
green/red), so the diff panel ignored built-in palettes and custom CLI
stylesheets.

Bridge the library's `--diffs-*` CSS variable inputs to the existing app
theme tokens (`--background`, `--foreground`, `--diff-added`,
`--diff-removed`) in theme.css. Line numbers, context tints, separators,
and the +/- row fills all derive from bg/fg inside the library, so
bridging those four inputs per mode is enough. Because palettes and the
custom stylesheet already override those app tokens, the diff panel (and
the shared file preview) now follow every theme with no per-palette work.

Syntax-highlighting token colors are unchanged — still the library's
pierre-light/pierre-dark Shiki palette (that's a separate follow-up).

Adds a Ladle story (GitDiffCard.stories.tsx) with a palette picker
rendering a sample patch in light and dark side by side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SawyerHood SawyerHood merged commit ea639a4 into main Jun 20, 2026
6 checks passed
@SawyerHood SawyerHood deleted the bb/fix-diff-panel-theme-thr_adkx7wh5tb branch June 20, 2026 22:44
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