1

I am trying to set-up a simple vim colorscheme, which is black text on white background.

How do I make the background go White?

Based on bw.vim, however I am having a problem getting the background to go white, it goes gray instead.

hi Normal         ctermbg=White        ctermfg=Black

Gives the same result as:

hi Normal         ctermbg=Gray         ctermfg=Black

enter image description here

Although reversing them I can get White text on a black background.

Vim is running in an xterm with t_Co==8, Vim version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul  4 2011 14:31:51)

Update1

Using Gnome Terminal 2.16, Which uses a 16 color palette although :

tput colors
8

The terminal is telling applications it has 8 colors, which is setting t_Co to 8 in Vim.

Vim is using this info and using 'palette entry 8' for White, which in my case was set to a medium Gray. Not sure if the real issue is an incorrect response from tput or the incorrect mapping of White to the palette.

Update2

Adding -256color to term makes tput return 256 and makes vim t_Co 256 as well.

For csh:

setenv TERM $TERM-256color

Originally hesitant to blindly apply 256 color to any system I may be working on, but I think it would be rare to come across a terminal that does not support 256 colors these days. This would also have to be a system/network where I have already set-up my dotfiles.

2 Answers 2

4

if your terminal emulator is gnome-terminal, it has a setting for manually modifying the standard 16 colors it supports (gnome-terminal does not support 256 colors). go to profile preferences -> colors and update the white color, it may be gray over there.

4
  • 1
    Using GNOME Terminal 2.16, Which has a 16 colour palette, t_Co set to 8 by default. White picks up palette entry 8. White is held in palette entry 16 by default.
    – Munkymorgy
    Jun 6, 2013 at 12:30
  • 1
    My gnome-terminal does support 256 colors?! paste.nerv.fi/69030286-gnome-terminal-w-256-colours.png --- I see everyone talks about older versions so maybe not valid. Worth a mention anyway!
    – mike3996
    Jun 6, 2013 at 17:03
  • indeed, mine does too, and my version (3.4.1.1) is way more recent than yours :-) I was led to error by another script I ran some while ago that showed me only 16 colors where it shall have shown 256 colors (to prove that the terminal is actually 256 colors).
    – zmo
    Jun 6, 2013 at 17:42
  • 2
    BTW, setting environment variable TERM=$TERM-256color can help a lot of programs detect correctly the terminal type.
    – zmo
    Jun 6, 2013 at 17:42
2

If your terminal emulator supports 256 colors, enable 256 colors in vim:

set t_Co=256

The background should show up white after issuing

:highlight Normal ctermfg=black ctermbg=white
1
  • I am trying to set-up colourschemes to fall back to based on t_Co and wanting just a basic black and white version. Might try this though and it will work where possible.
    – Munkymorgy
    Jun 6, 2013 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .