fix(highlight): use theme-agnostic fallbacks and retry when Normal has no background (#153)

## Problem

Highlight group fallbacks in `compute_highlight_groups` were hardcoded
to
catppuccin mocha colors, producing wrong results for any other
colorscheme
when `Normal.bg` is nil. This happens on transparent terminals or when
the
colorscheme loads after the first diff buffer opens.

## Solution

Replace hardcoded fallbacks with `vim.o.background`-aware neutral
values.
When `Normal.bg` is still absent after initial computation, schedule a
single
deferred retry via `vim.schedule` that recomputes and invalidates all
attached
buffer caches. Document the load-order requirement in the setup section.
This commit is contained in:
Barrett Ruth 2026-03-05 19:50:22 -05:00 committed by GitHub
parent e7d56e3bbe
commit 58589947e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 6 deletions

View file

@ -65,6 +65,9 @@ Install with lazy.nvim: >lua
The plugin works automatically with no configuration required. For
customization, see |diffs-config|.
NOTE: Load your colorscheme before `diffs.nvim`. For example, with lazy.nvim,
set `priority = 1000` and `lazy = false` on your colorscheme plugin.
==============================================================================
CONFIGURATION *diffs-config*
@ -758,6 +761,7 @@ character-level groups blend at 60% for more contrast. Line-number groups
combine both: background from the line-level blend, foreground from the
character-level blend.
Fugitive unified diff highlights: ~
*DiffsAdd*
DiffsAdd Background for `+` lines. Derived by blending