-->

Vim colors too bright (terminal)

2020-06-27 09:05发布

问题:

I have a problem with Vim and iTerm2, the colors are too bright (for ALL themes). It works with both Terminal.app and MacVim, so I guess it must be some setting in iTerm2 I've completely missed.

The picture below shows you the difference (iTerm2 to the left, MacVim / Terminal.app to right):

What I'm using:

iTerm2: Build 1.0.0.20130624
Terminal type: xterm-256
Shell: zsh 5.0.2
Vim: version 7.3.666
OS X: 10.7.5

Do you guys have any idea what I'm missing?

回答1:

You shouldn't compare colorschemes in GUI Vim and in CLI Vim: the number of colors that can be used in both contexts is very different and it makes any comparison worthless. You can get very subtle colors in GUI Vim but you can only approximate them in CLI Vim.

The values used for the gui and those used for the cli are probably different which explains what you see.

The only way to have the same colors in gui and cli vim is to use only colors from the xterm palette for the gui.

In Vim, you could :set background=light (and read :help 'background') to see if it makes the colors less bright.

In your terminal emulator, you could see if there's a setting that deals with color brightness or the usage of bold.



回答2:

Adding this to my vimrc after the colorscheme definition worked for me.

hi Normal ctermbg=16

Color codes are defined here: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim