Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PmenuSel might need adjustment to work with colored items #265

Open
echasnovski opened this issue Aug 29, 2024 · 0 comments
Open

PmenuSel might need adjustment to work with colored items #265

echasnovski opened this issue Aug 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@echasnovski
Copy link

After vim/vim#15314 and vim/vim#15561 it is now possible for completion items to have a dedicated highlighting through hl_group and kind_hlgroup item fields. Those highlight groups are applied while combining with underlying highlighting. Which is a good thing as it allows to use highlight groups defining only necessary attributes (like foreground, for example, which I'd assume would be very common).

However, this can result in poorly readable text if color scheme has PmenuSel very different from Pmenu in terms of background lightness. Here is an example with 'evening' color scheme:

screenshot_2024-08-29_16:38:49

screenshot_2024-08-29_16:39:03

One possible solution to this is to switch fg/bg attributes for Pmenu*Sel groups and add reverse attribute. This way highlighting of "regular" items stays the same while "highlighted" items have colored backgrounds with readable text. Here is an example with adjusted groups:

screenshot_2024-08-29_16:39:24

screenshot_2024-08-29_16:39:35


Code used for testing:

func CompleteWithHl()
  let l:item_1 = { 'word': 'apple',   'kind': 'Fruit', 'hl_group': 'String', 'kind_hlgroup': 'Identifier' }
  let l:item_2 = { 'word': 'apricot', 'kind': 'Fruit', 'hl_group': 'String', 'kind_hlgroup': 'Identifier' }
  let l:item_3 = { 'word': 'avocado', 'kind': 'Fruit' }
  call complete(1, [item_1, item_2, item_3])
  return ''
endfunc

set termguicolors
set bg=dark
color evening

" Current:
" hi PmenuSel      guifg=#000000 guibg=#bebebe gui=NONE cterm=NONE
" hi PmenuMatchSel guifg=#8b008b guibg=#bebebe gui=NONE cterm=NONE

" " Adjusted
" hi PmenuSel      guifg=#bebebe guibg=#000000 gui=reverse cterm=reverse
" hi PmenuMatchSel guifg=#bebebe guibg=#8b008b gui=reverse cterm=reverse
@romainl romainl added the enhancement New feature or request label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants