From 5cfa91039b6b6430c55b03609005185b625e9490 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Feb 2026 15:29:19 -0500 Subject: [PATCH] fix(highlight): use correct line number gutter colors Problem: DiffsAddNr/DiffsDeleteNr used raw diffAdded/diffRemoved foreground and the word-level blended background, instead of matching the line-level and character-level highlight groups. Solution: set gutter bg to the line-level blend (DiffsAdd/DiffsDelete) and fg to the character-level blend (DiffsAddText/DiffsDeleteText). --- doc/diffs.nvim.txt | 8 +++++--- lua/diffs/init.lua | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/diffs.nvim.txt b/doc/diffs.nvim.txt index 6443063..42009e9 100644 --- a/doc/diffs.nvim.txt +++ b/doc/diffs.nvim.txt @@ -404,7 +404,9 @@ always derived from the corresponding `Diff*` groups. All derived groups are computed by alpha-blending a source color into the `Normal` background. Line-level groups blend at 40% alpha for a subtle tint; -character-level and line-number groups blend at 60% for more contrast. +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* @@ -417,11 +419,11 @@ Fugitive unified diff highlights: ~ *DiffsAddNr* DiffsAddNr Line number for `+` lines. Foreground from - `diffAdded`, background from `DiffsAddText`. + `DiffsAddText`, background from `DiffsAdd`. *DiffsDeleteNr* DiffsDeleteNr Line number for `-` lines. Foreground from - `diffRemoved`, background from `DiffsDeleteText`. + `DiffsDeleteText`, background from `DiffsDelete`. *DiffsAddText* DiffsAddText Character-level background for changed characters diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index 76c17d6..cfdfb4b 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -198,8 +198,12 @@ local function compute_highlight_groups() vim.api.nvim_set_hl(0, 'DiffsClear', { default = true, fg = normal.fg or 0xc0c0c0 }) vim.api.nvim_set_hl(0, 'DiffsAdd', { default = true, bg = blended_add }) vim.api.nvim_set_hl(0, 'DiffsDelete', { default = true, bg = blended_del }) - vim.api.nvim_set_hl(0, 'DiffsAddNr', { default = true, fg = add_fg, bg = blended_add_text }) - vim.api.nvim_set_hl(0, 'DiffsDeleteNr', { default = true, fg = del_fg, bg = blended_del_text }) + vim.api.nvim_set_hl(0, 'DiffsAddNr', { default = true, fg = blended_add_text, bg = blended_add }) + vim.api.nvim_set_hl( + 0, + 'DiffsDeleteNr', + { default = true, fg = blended_del_text, bg = blended_del } + ) vim.api.nvim_set_hl(0, 'DiffsAddText', { default = true, bg = blended_add_text }) vim.api.nvim_set_hl(0, 'DiffsDeleteText', { default = true, bg = blended_del_text })