feat(ui): honor transparent background in static pager output#418
feat(ui): honor transparent background in static pager output#418franky47 wants to merge 1 commit into
Conversation
When using hunk as a pager in lazygit in a transparent-background terminal (Ghostty), the static ANSI output of the pager caused solid backgrounds on context lines and other non-diff elements. This uses a similar system as the TUI to mark surfaces as transparent in the pager output, but keeps +/- background tints painted so they're easier to see visually in diffs.
Greptile SummaryThis PR adds transparent-background support to the static pager output path so that tools like LazyGit running in translucent terminals (e.g. Ghostty) no longer paint solid backgrounds on context lines, gutters, and hunk headers.
Confidence Score: 5/5Safe to merge — the change is additive, isolated to theme resolution in the static pager path, and cannot affect the interactive TUI. The new withTransparentSurfaces function is a straightforward spread-and-override of the theme struct, following the exact same pattern as the already-tested withTransparentBackground. The static pager only consumes panel, panelAlt, lineNumberBg, contextBg, addedBg, removedBg, movedAddedBg, and movedRemovedBg — all correctly handled. Tests assert specific ANSI escape codes on both transparent and painted rows, and the implementation aligns with what stackCellPalette and renderStaticRow actually read from the theme. No pre-existing paths are touched. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[renderStaticDiffPager] --> B[resolveTheme]
B --> C{options.transparentBackground?}
C -- yes --> D[withTransparentSurfaces]
C -- no --> E[resolvedTheme as-is]
D --> F[theme with transparent neutrals\nbackground, panel, panelAlt\ncontextBg, contextContentBg, lineNumberBg]
D --> G[diff tints kept painted\naddedBg, removedBg\nmovedAddedBg, movedRemovedBg\naddedContentBg, removedContentBg]
F --> H[renderStaticFile → renderStaticRow]
G --> H
E --> H
H --> I{row type}
I -- hunk-header / collapsed --> J[bg = panelAlt = transparent]
I -- stack-line addition --> K[bg = addedBg painted]
I -- stack-line deletion --> L[bg = removedBg painted]
I -- stack-line context --> M[bg = contextBg = transparent]
Reviews (1): Last reviewed commit: "feat(ui): honor transparent background i..." | Re-trigger Greptile |
When using hunk as a pager in lazygit in a transparent-background terminal (Ghostty), the static ANSI output of the pager caused solid backgrounds on context lines and other non-diff elements:
Before
After
This change uses a similar system as the TUI to mark surfaces as transparent in the pager output, but keeps +/- background tints painted so they're easier to see visually in diffs: