fix(highlight): reduce word-level blend alpha and match line number bg
Problem: word-level diff highlights were too intense at 70% alpha, and line number backgrounds used the line-level blend instead of matching the word-level highlights. Solution: reduce DiffsAddText/DiffsDeleteText blend alpha from 0.7 to 0.6 and use the same blended background for DiffsAddNr/DiffsDeleteNr.
This commit is contained in:
parent
d353a6a314
commit
d10eaed6ac
2 changed files with 12 additions and 8 deletions
|
|
@ -402,6 +402,10 @@ diffs.nvim defines custom highlight groups. Fugitive unified diff groups use
|
||||||
`default = true`, so colorschemes can override them. Diff mode groups are
|
`default = true`, so colorschemes can override them. Diff mode groups are
|
||||||
always derived from the corresponding `Diff*` groups.
|
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.
|
||||||
|
|
||||||
Fugitive unified diff highlights: ~
|
Fugitive unified diff highlights: ~
|
||||||
*DiffsAdd*
|
*DiffsAdd*
|
||||||
DiffsAdd Background for `+` lines. Derived by blending
|
DiffsAdd Background for `+` lines. Derived by blending
|
||||||
|
|
@ -413,23 +417,23 @@ Fugitive unified diff highlights: ~
|
||||||
|
|
||||||
*DiffsAddNr*
|
*DiffsAddNr*
|
||||||
DiffsAddNr Line number for `+` lines. Foreground from
|
DiffsAddNr Line number for `+` lines. Foreground from
|
||||||
`diffAdded`, background from `DiffsAdd`.
|
`diffAdded`, background from `DiffsAddText`.
|
||||||
|
|
||||||
*DiffsDeleteNr*
|
*DiffsDeleteNr*
|
||||||
DiffsDeleteNr Line number for `-` lines. Foreground from
|
DiffsDeleteNr Line number for `-` lines. Foreground from
|
||||||
`diffRemoved`, background from `DiffsDelete`.
|
`diffRemoved`, background from `DiffsDeleteText`.
|
||||||
|
|
||||||
*DiffsAddText*
|
*DiffsAddText*
|
||||||
DiffsAddText Character-level background for changed characters
|
DiffsAddText Character-level background for changed characters
|
||||||
within `+` lines. Derived by blending `diffAdded`
|
within `+` lines. Derived by blending `diffAdded`
|
||||||
foreground with `Normal` background at 70% alpha.
|
foreground with `Normal` background at 60% alpha.
|
||||||
Only sets `bg`, so treesitter foreground colors show
|
Only sets `bg`, so treesitter foreground colors show
|
||||||
through.
|
through.
|
||||||
|
|
||||||
*DiffsDeleteText*
|
*DiffsDeleteText*
|
||||||
DiffsDeleteText Character-level background for changed characters
|
DiffsDeleteText Character-level background for changed characters
|
||||||
within `-` lines. Derived by blending `diffRemoved`
|
within `-` lines. Derived by blending `diffRemoved`
|
||||||
foreground with `Normal` background at 70% alpha.
|
foreground with `Normal` background at 60% 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.
|
||||||
|
|
|
||||||
|
|
@ -192,14 +192,14 @@ 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_fg, bg, 0.7)
|
local blended_add_text = blend_color(add_fg, bg, 0.6)
|
||||||
local blended_del_text = blend_color(del_fg, bg, 0.7)
|
local blended_del_text = blend_color(del_fg, bg, 0.6)
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, 'DiffsClear', { default = true, fg = normal.fg or 0xc0c0c0 })
|
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, '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 })
|
||||||
vim.api.nvim_set_hl(0, 'DiffsAddNr', { default = true, fg = add_fg, bg = blended_add })
|
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 })
|
vim.api.nvim_set_hl(0, 'DiffsDeleteNr', { default = true, fg = del_fg, bg = blended_del_text })
|
||||||
vim.api.nvim_set_hl(0, 'DiffsAddText', { default = true, bg = blended_add_text })
|
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 })
|
vim.api.nvim_set_hl(0, 'DiffsDeleteText', { default = true, bg = blended_del_text })
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue