articlesabout

Edit or remove the background color for vim's Jellybeans colorscheme

The Jellybeans colorscheme for vim is great, but its implementation is a little bit contrived when compared to other colorschemes. It features a complex support for greyscale and RGB approximations, meaning it will do its best to guess smart RGB values based on your terminal "depth". For instance, you may have enabled support for 24, 88 or even 256 colors in your rxvt shell, and because the hexa color codes provided in the colorscheme may not be exactly those enforced by the terminal, Jellybeans will try to convert its color codes using a smoothing strategy over the RGB colorspace. To put it simply, Jellybeans does some pretty advanced magic, but sometimes, the magic backfires.

Therefore, if you use vim in the terminal (ie. not gvim), you may be puzzled by the fact this colorscheme enforces a background color… yet seems to be unable to devise a correct hexa code for it. To change the color, or to get rid of it entirely (so as to fallback on your terminal’s background color), simply edit lines #308 and #309 of ~/.vim/colors/jellybeans.vim:

call s:X("Normal","e8e8d3","BackgroundColor","","White","")
call s:X("LineNr","605958","BackgroundColor","none","Black","")

By setting the BackgroundColor to an empty value, one can fully integrate vim into the terminal profile.

Note that when using set background=dark in vim's configuration file, it behaves as a very generic hint, merely stating that the background of the colorscheme is to be considered "of the dark side" so further color adjustments may be made.

Several other color schemes make use of the color approximation functions; for instance, desert256, wombat256 or mrkn256. Feel then free to test them if you’re using a 256 colors terminal.

Sep 4, 20101 min readSummary: Jellybeans' support for colors is quite complicated, but it can be made to _just work_.