coc.nvim selected suggestion background color - coc.nvim

The background color of the currently-selected-suggestion does not contrast enough with the text to be readable. How can this be fixed?
Setting Pmenu and/or PmenuSel in does NOT improve the situation, as neither change this background color.
.exrc is EMPTY (so no color changes by me)
Using default terminal program, without changing any colors.
Using vim (8.2) on MacOS Monterey (12.5) with the M1 (arm64) cpu.
Same issue on iTerm2 using custom color scheme, so it's not the terminal's fault, I don't think.

Same problem on my side, after trial and error using
hi CocMenuSel ctermbg=darkgrey ctermfg=yellow
hi CocSearch ctermfg=blue
in ~/.vimrc
produces a reasonable contrast on my side with on a Mac with white terminal bg.
Use :hi to scroll thru the color suggestions of vim to see the possible names and color appearance.

Related

VIM colors in Ubuntu20.04 terminal

After going down the wrong rabbit hole, looking at themes for terminal in Ubuntu20.04 I realized what I really needed to change was the colorscheme in vim. I have found they are listed in /usr/share/vim/vim81/colors/*.vim
One of the things I don't understand, is that Putty seems to have the colors I like, am used to, and can most easily see, when when I type ":colorscheme" while a file is open in the vim editor, it outputs "default". I DO NOT understand why the default theme looks correct to me in PuTTy, but not in Terminal. If I had the option of changing the font family and size in PuTTy in Ubuntu20.04 I would likely just use it. As it is, it is too small, I can barely see the font. Thus, I need to use terminal. However, the colors make it hard for me to see.
The colors I want (specifically for Python, but putty just always has the right colors) are the ones that PuTTy seems to be using when I type ":colorscheme default" but I want these colors for terminal.
Does anyone know how to get "terminal" to display the same colors that PuTTy displays? Or has anyone created a custom "*.vim" color file that I can download and use as the colorscheme in VIM for my terminal?
Terminal, using ViM81's :colorscheme=default:
VIM, using ViM81's :colorscheme=default:
If any one can provide a link to a page that tells me what to do, or to a colorscheme.vim file for terminal's VIM, I'd really appreciate it.
A colorscheme is essentially a sequence of Ex commands like this one:
highlight Foo cterm=NONE ctermbg=red ctermfg=224 gui=NONE guibg=#ff0000 guifg=#ffdfdf
that define, for a given highlight group (for Foo, here):
a text style for terminal emulators with cterm,
a background color for terminal emulators with ctermbg,
a foreground color for terminal emulators with ctermfg,
a text style for GUI Vim with gui,
a background color for GUI Vim with guibg,
a foreground color for GUI Vim with guifg.
Since you are talking colors and terminal emulators, only ctermbg and ctermfg are relevant.
ctermbg and ctermfg can be given different kinds of values whose effect might differ depending on your environment:
1-15 would mean "use color at given index in the so-called ANSI palette",
red would mean "use color with given name in the so-called ANSI palette",
16-255 would mean "use color at given index 224 in the so-called xterm palette".
There are literally thousands of custom colorschemes in existence and colorscheme authors may favor one notation over the other, mix them, or even don't use them at all because they only care about GVim. "YMMV" is not a joke when talking about Vim colorschemes.
What notation is used by the default colorscheme mostly depends on your environment, which has thus a lot of influence on how things look.
For example, if your $TERM is something like xterm, Vim assumes that your terminal emulator can only display 8-16 colors so it uses the first notation. This means that the colors you see are all taken from your terminal emulators so-called ANSI palette, which a) changes from terminal emulator to terminal emulator, and b) can generally be modified by the user anyway. In this context, there is no way whatsoever for Vim to make any guarantee about what colors will be used in the end.
If your $TERM is something like xterm-256color, Vim assumes that your terminal emulator can display 256 colors so it uses, and that's really annoying, a mix of the first and third notations. Colors 16-255's big advantages over colors 0-15 are a) that they are not easily changed by the user, and b) that they can reasonably be expected to be the same on most terminal emulators that implement them. The annoying bit is that Vim uses lots of colors in the 0-15 range, which can't be trusted, in combination with colors in the 16-255 range, which can be trusted.
The ultimate consequence is that default can't be expected to be consistant across terminal emulators without some fiddling.
Where to go from there?
First, if you expect n Vims, in n terminal emulators, on n platforms to behave the same, the very least you have to do is:
make sure $TERM matches,
make sure it actually is the exact same Vim version with the exact same patches applied,
make sure colors 0-15 of all terminal emulators are the exact same,
and, since you mentioned font size, make sure you have the exact same font installed everywhere and all your terminal emulators set to use it at the exact same size.
If you want to stick with default, then checking all of the above should get you closer to where you want to be. If you can't, then you can give up right away.
Second, Vim comes with lots of alternative colorschemes out of the box, so you could try them and see if there is one that works better for you:
:colorscheme <Tab>
Third, as mentioned above, you could try some of the many custom colorschemes publicly available. Be aware that they may come with different sets of features and different requirements.
The default colors for Vim are specified in terms of the 16-color ANSI palette. This palette goes back to EGA, and it roughly defines eight colors, possibly with a bold (bright) version of each. The difference that you're seeing is that the definition is approximate. For example, color 1 is red and color 4 is blue, but nobody mandates what color that red and blue are. Specifically, in many cases, the regular (non-bright) yellow is brown.
If you want to set the colors to be different in Ubuntu, you should be able to configure the terminal emulator in its settings. GNOME terminal, which is what it looks like you're using, should allow this. The Wikipedia page on ANSI terminal codes contains information on which actual colors are mapped to different color numbers.
Thanks to romainl I got it all working the way I wanted it to.
In VIM, when I typed in ":colorscheme" it output "default",... YET when I typed ":colorscheme default" it actually changed the colors to ALMOST match what was in PuTTy. Then, I just had to add a few adjustments to my ~/.vimrc and ~/.vim/syntax/python.vim files. Below are those adjustments...
In my .vimrc file, I had to move:
syntax on
filetype detect
filetype plugin on
From the bottom of my .vimrc file, to almost the very the top, as it was getting overwritten by something. Then, I added one line above that (:colorscheme default (to force it to switch to the "real" default")), and 5 lines below it. Now my .vimrc contains (amongst MANY other customizations):
colorscheme default
syntax on
filetype detect
filetype plugin on
hi Comment ctermbg=black ctermfg=green cterm=None
hi String ctermbg=black ctermfg=1 cterm=None
hi Statement ctermbg=black ctermfg=yellow cterm=None
hi StatusLine ctermbg=0 ctermfg=7
hi StatusLineNC ctermbg=252 ctermfg=238 guibg=#d0d0d0 guifg=#444444
Additionally, my python syntax file (located at ~/.vim/syntax/python.vim) needed these adjustments:
hi Statement ctermbg=black ctermfg=yellow cterm=bold
hi pythonStatement ctermbg=black ctermfg=yellow cterm=None
hi Conditional ctermbg=black ctermfg=yellow cterm=None
hi pythonComment ctermbg=black ctermfg=green cterm=None
hi pythonString ctermfg=1 cterm=None
hi pythonQuotes ctermfg=blue cterm=bold
Again, special thanks to the answer above from: romainl with his/her help, and the above customizations, I was able to get my VIM colors in Ubuntu20.04 Terminal to match my VIM colors in PuTTy that I was used to.
P.S. My term-type is xterm
I'm not sure if this is exactly what you are looking for, but... I ran into a problem that the color schemes in my terminal did not look like they looked on the previews on https://vimcolorschemes.com.
Adding the following lines solved to ~/.vimrc solved problem for me:
if !has('gui_running')
set t_Co=256
endif
set termguicolors

Disable background transparency in (neo)vim

I'm running Neovim 0.2.1 in Konsole with i3 and Compton in the back. I'm using a little bit of transparency in Konsole for a more dapper experience, but given that I use vim as my primary editor I'd prefer to not have transparency there as it's a little bit distracting. My colour scheme is vim-monokai.
What's really got me scratching my head is that I have two computers, both running virtually the same setup (Intel integrated graphics, i3, Compton, Konsole, zsh, same neovim version and plugins). One does not have transparency in its terminal, while the other does.
For vim:
highlight Normal ctermbg=Black
highlight NonText ctermbg=Black
Your colorschema most likely does not set ctermbg. Replace "Black" with the desired background color.

Vim color scheme overriding the background settings in Gnome Terminal

I have set my gnome-terminal's background to dark-blue, with a bit of transparency so I can see the underlying webpages or other documents when I code.
I've been using the smyck color scheme, which appears to be my terminal background as its background, so it looks seamless when I enter Vim.
(my terminal window on top of a web page)
(the very same terminal window entering vim)
Lately I decided to switch to some other color scheme. As I was trying out jellybeans, I noticed that it has overridden my default terminal background settings, both its color and transparency, as you can see below.
(the very same terminal window entering vim now with jellybeans)
I have installed the AfterColors plugin, but I don't know where to start to tweak the color scheme to have the default background back. Any suggestioins?
Set the ctermbg to none:
hi Normal ctermbg=none
In addtional of perreal's answer, you also need to
highlight NonText ctermbg=none
this will help make other "nothing exist" region to be transparent.

How to base vim colors off of iTerm colors?

I recently updated my iTerm color scheme and when I make a selection in visual mode (using vim) the color is awful. iTerm has some color options for Selection and Selection text what I would like to use as guibg and guifg respectivly. I tried this in my vim config but couldn't get it to work.
hi Visual guifg=SelectionText guibg=Selection
Is this possible to do?
As far as I know, the colors used for text, background, selection and friends are not exported by iTerm so what you want is out of reach.
Instead, use the same color you used in the settings window, converted to its nearest neighbor in the xterm palette.
Also, you are supposed to use ctermbg and ctermfg as guibg and guifg are, obviously, for GUI Vim and thus wrong and useless in your situation.
Example:
hi Visual ctermfg=16 ctermbg=67

How do I make a vim color scheme work with gvim?

I am trying to use this color scheme
https://github.com/goatslacker/mango.vim
It works when I open vim from the command line. But I usually open files from the file manager GUI and that opens them in gvim. The color scheme displays a white background in gvim. How do I fix it so it displays a dark background?
I've looked at the mango.vim file and it has the line set background=dark but apparently that is not working.
Vim separates between term, cterm (color terminal) and gui since they are capable of handling different numbers of colors
mango.vim only gives highlighting instructions for cterm. If it were for gui aswell it would look like this:
hi Comment term=bold ctermfg=Red guifg=Red0
So if your color-scheme lacks gui support it will reset to default.

Resources