fix(highlight): use diffAdded/diffRemoved fg for char-level backgrounds
The previous 70% alpha blend of DiffAdd bg was nearly identical to the 40% line-level blend, making char-level highlights invisible. Now blends the bright diffAdded/diffRemoved foreground color (same base as line number fg) into the char-level bg, matching GitHub/VSCode intensity. Also bumps intra.max_lines default from 200 to 500.
This commit is contained in:
parent
63b6e7d4c6
commit
f1c13966ba
2 changed files with 13 additions and 12 deletions
|
|
@ -62,12 +62,12 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
||||||
},
|
},
|
||||||
vim = {
|
vim = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
max_lines = 200,
|
max_lines = 500,
|
||||||
},
|
},
|
||||||
intra = {
|
intra = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
algorithm = 'auto',
|
algorithm = 'auto',
|
||||||
max_lines = 200,
|
max_lines = 500,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fugitive = {
|
fugitive = {
|
||||||
|
|
@ -165,7 +165,7 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
||||||
`vim.diff()`. `'vscode'`: require libvscodediff
|
`vim.diff()`. `'vscode'`: require libvscodediff
|
||||||
(falls back to native if not available).
|
(falls back to native if not available).
|
||||||
|
|
||||||
{max_lines} (integer, default: 200)
|
{max_lines} (integer, default: 500)
|
||||||
Skip character-level highlighting for hunks larger
|
Skip character-level highlighting for hunks larger
|
||||||
than this many lines.
|
than this many lines.
|
||||||
|
|
||||||
|
|
@ -382,15 +382,16 @@ Fugitive unified diff highlights: ~
|
||||||
|
|
||||||
*DiffsAddText*
|
*DiffsAddText*
|
||||||
DiffsAddText Character-level background for changed characters
|
DiffsAddText Character-level background for changed characters
|
||||||
within `+` lines. Derived by blending `DiffAdd`
|
within `+` lines. Derived by blending `diffAdded`
|
||||||
background with `Normal` at 70% alpha (brighter
|
foreground with `Normal` background at 40% alpha.
|
||||||
than line-level `DiffsAdd`). Only sets `bg`, so
|
Uses the same base color as `DiffsAddNr` foreground,
|
||||||
treesitter foreground colors show through.
|
making changed characters clearly visible. Only sets
|
||||||
|
`bg`, so treesitter foreground colors show through.
|
||||||
|
|
||||||
*DiffsDeleteText*
|
*DiffsDeleteText*
|
||||||
DiffsDeleteText Character-level background for changed characters
|
DiffsDeleteText Character-level background for changed characters
|
||||||
within `-` lines. Derived by blending `DiffDelete`
|
within `-` lines. Derived by blending `diffRemoved`
|
||||||
background with `Normal` at 70% alpha.
|
foreground with `Normal` background at 40% alpha.
|
||||||
|
|
||||||
Diff mode window highlights: ~
|
Diff mode window highlights: ~
|
||||||
These are used for |winhighlight| remapping in `&diff` windows.
|
These are used for |winhighlight| remapping in `&diff` windows.
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ local default_config = {
|
||||||
intra = {
|
intra = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
algorithm = 'auto',
|
algorithm = 'auto',
|
||||||
max_lines = 200,
|
max_lines = 500,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fugitive = {
|
fugitive = {
|
||||||
|
|
@ -183,8 +183,8 @@ local function compute_highlight_groups()
|
||||||
local blended_add = blend_color(add_bg, bg, 0.4)
|
local blended_add = blend_color(add_bg, bg, 0.4)
|
||||||
local blended_del = blend_color(del_bg, bg, 0.4)
|
local blended_del = blend_color(del_bg, bg, 0.4)
|
||||||
|
|
||||||
local blended_add_text = blend_color(add_bg, bg, 0.7)
|
local blended_add_text = blend_color(add_fg, bg, 0.4)
|
||||||
local blended_del_text = blend_color(del_bg, bg, 0.7)
|
local blended_del_text = blend_color(del_fg, bg, 0.4)
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'DiffsAdd', { default = true, bg = blended_add })
|
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, 'DiffsDelete', { default = true, bg = blended_del })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue