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

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

Open
nickjj opened this issue Jan 4, 2020 · 10 comments
Open

Comments

@nickjj
Copy link

nickjj commented Jan 4, 2020

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
Copy link

gmichokostas commented Jan 6, 2020

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
Copy link
Author

nickjj commented Jan 6, 2020

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
Copy link

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
Copy link
Author

nickjj commented Jan 6, 2020

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

@gmichokostas
Copy link

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

@nickjj
Copy link
Author

nickjj commented Jan 6, 2020

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
Copy link

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
Copy link

rbong commented Mar 26, 2021

@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
Copy link

ramn51 commented Sep 11, 2021

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

@sozoalvin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants