Add diff line background intensity option#691
Merged
backnotprop merged 1 commit intoMay 11, 2026
Conversation
318e667 to
70d4d6a
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add diff line background intensity option
Motivation
For me the default diff line background is very pale — green/red lines fade into the page tint and the diff is hard to scan, especially on light themes. This PR adds a user-facing toggle so anyone with the same pain can crank the line bg up without affecting users who like the current look.
Summary
Adds a
Line Background Intensitysetting (Subtle / Normal / Strong) so users can opt into a bolder green/red line background. Defaults toSubtle— existing users see no visual change.The control appears as a sub-option under
Show Diff Backgroundin both the diff-options popover and the Settings dialog; it's only shown when the parent toggle is on.Approach
@pierre/diffslibrary default exactly.--mix-light/--mix-darkpipeline rather than overriding the finalbackground-color. This keeps Pierre's--diffs-line-bgflow intact so selected / hovered / decorated line states still produce their state-specific visuals.--diffs-computed-diff-line-bg(oklch(from … calc(l ± 0.07) c h)), not from the theme's addition / deletion base color. The chip ends up "one perceptual step deeper than this specific line" at every intensity and across themes — no per-intensity emphasis tuning needed.--diffs-addition-base/--diffs-deletion-baseare respected — only the alpha/lightness scales, not the hue.Bug fix bundled in
Pierre's word-emphasis rule (
[data-line-type=…] [data-diff-span] { background-color: var(--diffs-bg-addition-emphasis) }) isn't gated on[data-background], so disablingShow Diff Backgroundused to leave the word-diff chips painted on plain lines. Added apre:not([data-background]) … { background-color: transparent !important }rule that applies at every intensity (including Subtle), so the toggle now consistently turns both line bgs and chips off.Drive-bys
.diff-line-addition/.diff-line-deletionrules inpackages/review-editor/index.css— these classes never actually reach Pierre's shadow DOM, so they had no effect and were misleading for anyone tracing where the diff bg lives.DiffHunkPreview— used in Code Tour, comment threads) pick up the same intensity setting, so the look stays consistent with the main diff viewer.*Changes authored by Claud
Screenshots (GitHub theme)
Subtle:

Normal:

Strong:
