gruvbox-community / gruvbox

Retro groove color scheme for Vim - community maintained edition
MIT License
801 stars 62 forks source link

Visual selections have very bright, harsh and inverted background colors #126

Open nickjj opened 4 years ago

nickjj commented 4 years ago

Hi,

When you make a visual selection, the selected background color of previously syntax highlighted code gets changed. The background color of the selection is also very bright.

This creates a very disorienting combination of colors. In fact, someone who watched one of my videos said they almost had a seizure when I selected some text.

I think a picture speaks a million words here. I ended up asking for help on IRC (thanks @romainl) and have a solution to fix it, but check this out to see the problem with a default installation of this theme:

vim-colors

The fix is to drop this into your ~/.vimrc file.

if (&background == 'dark')
  hi Visual cterm=NONE ctermfg=NONE ctermbg=237 guibg=#3a3a3a
else
  hi Visual cterm=NONE ctermfg=NONE ctermbg=223 guibg=#ffd7af
endif

I matched the colors to what the column marker color's is for both the dark and light variants.

It would be nice if this could get merged in at some point.

gmichokostas commented 4 years ago

There is a config option for that

You just have to put let g:gruvbox_invert_selection = 0 in your vimrc and your done :)

nickjj commented 4 years ago

Ah neat. Although in that case if I remove my snippet and replace it with your setting, it does fix the inverted colors but the selected color is too light for the dark variant and too dark for the light variant.

Here's a few examples:

Your setting suggestion without my color changes:

image

image

My color changes without your setting:

image

image

Personally I find the bottom set of screenshots a lot more readable when a selection is active. The contrast ratio is much higher and the selection itself is still bright enough to see it at a glance. It also matches the color column and cursorline colors if you have them enabled.

gmichokostas commented 4 years ago

Okay, I see what you mean. BTW your comment is not visible to the project but to your fork, I think you should open an issue here https://github.com/morhetz/gruvbox/issues instead

nickjj commented 4 years ago

I was under the impression the original repo is no longer maintained and this fork is the official unofficial successor to gruvbox?

gmichokostas commented 4 years ago

Ah apologises, I wasn't aware that the official plugin is not maintained any more :)

nickjj commented 4 years ago

I'm not 100% on the details but there's a lot of talk about it here from ~7 months ago: https://www.reddit.com/r/vim/comments/bu5x8c/starting_gruvbox_community_fork_all_pull_requests/

NoahRoseLedesma commented 3 years ago

Adding let g:gruvbox_invert_selection = 0 to my configuration file did not change the color of highlighted text. The workaround proposed by @nickjj worked for me. I am using NVIM-QT v0.2.16.1

rbong commented 3 years ago

@NoahRoseLedesma did you make sure to place the configuration line before colorscheme gruvbox?

Concerning the maintenance status of the original repo - I think the most Morhetz has said on it is that he's just busy. He also does not want to add more maintainers. It's not technically unmaintained, but he has said that if you want certain fixes, to fork it yourself. This community effort is just to get fixes in faster, and to avoid everyone having to make their own fork.

ramn51 commented 3 years ago

@rbong thanks for that part, initially had the configuration line before the line that you have mentioned. Its working now.

sozoalvin commented 3 years ago

thanks for the solution posted here. putting the code snippet let g:gruvbox_invert_selection=0 before colorscheme gruvbox in my .vimrc solved the issue for me