4

I'm using the colorscheme monokai and coc.nvim with pylint to lint Python code in Vim (terminal, not GUI, in terminal.app on macOS which I'm pretty sure has 256 colours). The linting pops up on a black background, so errors (red) are basically readable, but hints (blue) are very difficult to read:

enter image description here

Looking at the colorscheme, I wasn't able to figure out which value to change to get a different coloured background for these messages. For instance I would guess that one of these would be relevant:

hi ErrorMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
hi WarningMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE

But 231 per this website is white, so that doesn't seem to be the right line. Are there some defaults it might be inheriting?

Additional info: this really nifty tip shows a way to echo information about the highlight group under the cursor in normal mode, including name and colour. However it doesn't for the pop-up box that coc uses to show lint messages, so I'm still unsure.

1

1 Answer 1

5

Answer via this Reddit commenter: these floating boxes are controlled by coc itself.

  • In this case the box is called CocHintFloat and can be seen with :hi CocHintFloat.

  • In general :hi Co<tab> shows you all the possible coc highlight groups.

  • To change it, add eg highlight CocHintFloat ctermfg=Red guifg=#ff0000 to your .vimrc.

  • The background colour is the regular Pmenu specified in most colour schemes.

4
  • 1
    If CoC is using the new (introduced between 8.1 and 8.2) Vim popups then you should be able to change the background with Popup, too. (Thus not changing PMenu which is used in places other than standard popups.)
    – B Layer
    Aug 9, 2020 at 20:24
  • Thanks for the tip! As far as I can tell it doesn't, though. Aug 11, 2020 at 13:17
  • 1
    Ah, okay. Well it's a tip that will be come more useful with time as Vim's popups get wider adoption. :) Cheers.
    – B Layer
    Aug 11, 2020 at 17:09
  • 2
    For the floating popup I was getting, CocHintFloat didn't work for me, but CocFloating and CocErrorFloat did. See stackoverflow.com/a/64293783/629530. Maybe I was facing a different popup with my error? Just thought I'd share this in case this helped someone else.
    – firebush
    Jan 3, 2022 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.