Repository navigation
fix(site): correct diff viewer colors across all themes - #32073
Merged
Merged
Conversation
Use the supplied standard dark diff colors and extrapolate them to the light and colorblind themes. Add word-highlight tokens, stop @pierre/diffs from blending changed-line backgrounds into the code background, and give the inline tool diff header the same surface as the git panel header.
DanielleMaywood
approved these changes
Nov 12, 2026
Match the reference design: each file in the git panel diff viewer is a rounded surface-secondary card with the code inset inside it, file headers show plain coloured line counts, and changed-line gutters are slightly darker than the line.
The app's worker pool theme replaces the CodeView theme option, and its editor background matches the card, so the code area rendered the same gray as the header. Pin the git panel code background to surface-primary.
DanielleMaywood
approved these changes
Nov 12, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code diff viewers (Agents git panel, inline
edit_files/write_filediffs,SyntaxHighlighterdiffs, audit log diff) rendered wrong colors in every theme. This PR applies the corrected standard dark palette and extrapolates it to the light and colorblind themes.Two causes:
--surface-git-*token values were off, and there were no tokens for word-level highlights.@pierre/diffs1.5.1 uses--diffs-bg-*-overrideonly as acolor-mixtarget. In dark mode it renders changed lines as 80% code background and 20% token, so the tokens came out much darker than defined. fix: use theme git colors in the agents diff viewer #31867 routed the theme tokens into the viewer, which made this more visible. The newDIFFS_GIT_COLOR_CSS(passed asunsafeCSS) sets that mix to 0% on changed lines, so lines render the token exactly. Hover still tints changed lines.Changes:
index.css: new line colors for each theme, plus new--surface-git-added-emphasisand--surface-git-deleted-emphasistokens for word highlights.diffsGitColors.ts: one shared module for the diff style overrides and the CSS.SyntaxHighlighter,DiffViewer, and the tool diffs now all use it, soSyntaxHighlighterno longer keeps its own copy.DiffFileHeadernow usesbg-surface-secondary, matching the git panel header (#18181Bin dark).surface-secondarycard with the code inset 4px inside it, cards are 8px apart, and the header has no bottom border.CodeViewcomputes item heights fromitemMetricsrather than measuring them, so the 4px frame below the code is added topaddingBottom.--surface-primary(#09090Bdark, white light). The app'sDiffsWorkerPoolProvidertheme (coder-dark/coder-light) replaces each viewer'sthemeoption, and its editor background is the same gray as the card, so the code and header were indistinguishable. Storybook has no worker pool, which is why it looked correct there.+N −Ncounts through a sharedDiffStatsTextinstead of badges.EditFilesSingleSuccess{Light,ProtanDeuter,Tritan}stories, so Pixel has baselines outside the default dark theme.#1F2F1F#382423#1F4F28#5F2F2E#E2F7E2#FFEBE9#BDE8BC#FFCDCA#182D3A#37261D#03496A#5D321D#E2F3FF#FFECE3#B6E1FF#FFCFB9#182D3A#382423#03496A#5F2F2E#E2F3FF#FFEBE9#B6E1FF#FFCDCAThe colors were checked in Storybook with Playwright, reading computed styles inside the diff shadow DOM. Every theme and all three renderers match the table exactly, and the header is
#18181Bin dark and#F4F4F5in light. The card frame and the gaps were checked from painted pixels, and the gap between cards stays at exactly 8px while scrolling a large diff, which confirms the height metrics match the DOM.Screenshots
Coder Agents git panel diff viewer, rendered with the app's
coder-dark/coder-lighthighlighting theme (the oneDiffsWorkerPoolProviderapplies).Color derivation and decision log
Given (standard dark): added line
#1F2F1F, file header#18181B, added word highlight#1F4F28, deleted word highlight#5F2F2E.Method: convert the reference colors to OKLCH. Keep each role's lightness and chroma, and rotate the hue to the theme's added or deleted hue. This keeps perceived contrast consistent across hues.
144.6and red22.3come from the references. Sky238.1(199 89% 48%) and orange46.7(24 95% 53%) come from the existing colorblind--git-added/--git-deletedtokens.#382423.#FFEBE9/#FFCECB), which is a useful sanity check.index.css.Header:
--surface-secondaryin dark is already#18181B, so the git panel header was correct. The inline tool diff header was transparent over the Shiki theme background (#0A0C10), so it now usesbg-surface-secondary.Placement:
diffsGitColors.tssits next toshikiTheme.ts, which is already the shared@pierre/diffstheming module used outside AgentsPage (for example byDiffsWorkerPoolProvider).Risk:
DIFFS_GIT_COLOR_CSSdepends on--mix-light,--mix-dark, and--diffs-mixer, which are internal to@pierre/diffs1.5.1. The JSDoc says so; recheck after library upgrades.Card layout: taken from a dark-mode reference screenshot, measured by pixel:
#18181Bcard on the#09090Bpage, code inset with rounded corners, plain-text stats, and a changed-line gutter slightly darker than the line. The inline tool diffs keep their existing bordered card and header border; only their stats changed, so both headers match. The reference also showed a collapse chevron, which is a new feature and is not included. Its added count is#16A34A; this keeps--git-added-bright(#22C55Ein dark), so colorblind themes still apply.Contrast: in
light-protan-deuter, the--git-*-brightstat text on#F4F4F5is about 2.6:1. The tokens and that contrast are unchanged from the previous badges.Self-review: ran frontend-deep-review (8 roles) and frontend-review (FE1 to FE10). Fixed: an inlined single-use constant, trimmed comments, renamed the module to avoid confusion with
AgentsPage/utils/diffColors, and added theme stories (SyntaxHighlighterrenders insidedata-pixel="ignore", so its stories would not give Pixel coverage). Left as is: a pre-existing near-duplicate betweenDiffViewer'sHeaderContentandDiffFileHeader(nit, out of scope).