How to change coc.nvim floating window colors?
Asked Answered
M

3

19

I'm using coc.nvim plugin for C++ in my vim editor, here it's showing error but its colors hurt my eyes, I've been searching for solution but still don't know how to customize the colors

cocnvim floating window color

Mokas answered 3/10, 2020 at 3:35 Comment(1)
This isn't really a programming question so is off topic for stack overflowRabideau
H
29

To choose another background color you can use

:highlight CocFloating ctermbg=color

And to change the foreground (text) color of the error message use

:highlight CocErrorFloat ctermfg=color

where color is either a color name or a color number (generally from 0 to 15).

To read more on color values

:h cterm-colors

GUI

If you want to use a GUI for vim, you should consider using guibg and guifg arguments in addition to ctermbg and ctermfg.

guifg and guibg value is either a color name or a hex-encoded RGB value (ex. #ff0000 for red).

GUI color values can be found here

:h gui-colors
Halter answered 10/10, 2020 at 13:9 Comment(2)
thanks for your solution but mine is just customizing colors right on my terminal, I'm using ConEmu on windows, those colors actually came from this softwareMokas
does this go into vimrc? Or into the color file?Hardboiled
F
2

In their github Discussion, there is a conversation that can solve all problems with Coc FloatingWindow:

here is the link

Forenoon answered 13/2, 2022 at 14:40 Comment(0)
C
0

Here is what helped me fix the coloring in the floating menu in my black-background Vim. I added the following to ~/.vimrc:

hi CocFloating ctermbg=DarkGrey  " Floating menu bg color
hi CocMenuSel ctermbg=Blue       " Menu selection bg color
hi CocSearch ctermfg=Cyan        " Text color of the matching text

Note that ctermbg is used for background colors and ctermfg - for respective text colors. I believe that setting both of these values in each of the above three highlighting groups (camel-case names above) should cover all the colors in the floating menu. If you use the GUI version then look for guibg and guifg values of the same highlighting groups. More on using these ...fg/...bg values has already been described in another answer here, so look there if you need more info.

Celka answered 31/7 at 12:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.