diff options
author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2024-08-29 22:08:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-29 12:08:30 -0700 |
commit | 862679c70fa062e567fd7f720f9fd994fa023101 (patch) | |
tree | 4b39c8178c7362590655732c9ac4b479ceff16f5 /src | |
parent | 9a3c8f64a77742684e847221990a06ad87c03985 (diff) | |
download | rneovim-862679c70fa062e567fd7f720f9fd994fa023101.tar.gz rneovim-862679c70fa062e567fd7f720f9fd994fa023101.tar.bz2 rneovim-862679c70fa062e567fd7f720f9fd994fa023101.zip |
fix(highlight): update `PmenuSel` for colored completion items #30183
Problem: completion items can now have dedicated highlighting (through
`hl_group` and `kind_hlgroup` fields). Both of the fields combine
their highlight attributes with the underlying `PmenuXxx` group.
As default color scheme `Pmenu` and `PmenuSel` are intentionally
almost inverted versions of one another, the added highlighting will
be unreadable in one of them if done only through foreground (which is
the most convenient way for users and being able to do so is arguably
the biggest benefit of actually combining added highlighting).
Solution: adjust `PmenuSel` to utilize `attr=reverse`. This works
because `fg`/`bg` are first combined and only then reversed. This
results in a colored background for items with `hl_group` and
`kind_hlgroup` using text highlighting.
This also results in the same background for regular selected item,
while intentionally changing foreground from `Nvim{Light,Dark}Grey3`
to (essentially) `Nvim{Light,Dark}Grey2`. This both provides better
contrast ratio and does not need realigning of the whole block.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/highlight_group.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 0003aaeb72..3cb43e012e 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -144,6 +144,7 @@ static const char e_missing_argument_str[] static const char *highlight_init_both[] = { "Cursor guifg=bg guibg=fg", "CursorLineNr gui=bold cterm=bold", + "PmenuSel gui=reverse cterm=reverse,underline blend=0", "RedrawDebugNormal gui=reverse cterm=reverse", "TabLineSel gui=bold cterm=bold", "TermCursor gui=reverse cterm=reverse", @@ -358,7 +359,6 @@ static const char *highlight_init_light[] = { "NonText guifg=NvimLightGrey4", "NormalFloat guibg=NvimLightGrey1", "Pmenu guibg=NvimLightGrey3 cterm=reverse", - "PmenuSel guifg=NvimLightGrey3 guibg=NvimDarkGrey2 cterm=reverse,underline blend=0", "PmenuThumb guibg=NvimLightGrey4", "Question guifg=NvimDarkCyan ctermfg=6", "QuickFixLine guifg=NvimDarkCyan ctermfg=6", @@ -443,7 +443,6 @@ static const char *highlight_init_dark[] = { "NonText guifg=NvimDarkGrey4", "NormalFloat guibg=NvimDarkGrey1", "Pmenu guibg=NvimDarkGrey3 cterm=reverse", - "PmenuSel guifg=NvimDarkGrey3 guibg=NvimLightGrey2 cterm=reverse,underline blend=0", "PmenuThumb guibg=NvimDarkGrey4", "Question guifg=NvimLightCyan ctermfg=14", "QuickFixLine guifg=NvimLightCyan ctermfg=14", |