Background color does not change?

122 views
Skip to first unread message

Benjamin Buch

unread,
Feb 23, 2008, 5:15:28 PM2/23/08
to v...@vim.org
Hi,

I'm using vim on (X)Ubuntu Linux 7.10, with xfce terminal.
When I change the colorscheme with ":colorscheme [schemename]", all the
text colors change according to the scheme, but the background color
does not.

This is no problem with gvim though, but I prefer vim on the terminal...

Benjamin

madiyaan

unread,
Feb 23, 2008, 5:38:29 PM2/23/08
to vim_use
This also happens to me and it is really annoying. I use Putty as my
ssh client to ssh into a linux machine and use Vim 7.1 there. I would
really want my background colors to be vim colors but I haven't
figured out a way to do it.

There are two hackish ways but are not solutions:

1) Use gVim. Not a solution.
2) Change the background color of the shell itself (in my case Putty).
However, this is not a solution because I would like the color to be
the default for the shell and the color to change only when I have vim
open.

Please post here if you find a solution.

Not to hijack your thread but there are two more annoyances that I
have:

1) When you delete a buffer using bdelete, when vim navigates to the
last buffer and if it is the only buffer open, syntax highlighting is
lost.
2) I can't use shift-space as a shortcut in vim using Putty or the
command line. Even in gvim in Linux I cannot bind it.

If these issues are solved, it would make my life much better. :)

Benjamin Buch

unread,
Feb 24, 2008, 3:59:38 AM2/24/08
to v...@vim.org
Hi,

I think I've got it now.
It's because xfce-terminal supports only 256 colors, gvim much more.
So most vim colorschemes are created for use with gvim and thus contain
colors which cannot be displayed in xterm.

However, I found some useful links on that topic. There's also a tool
to convert gvim colorschemes to 256-color colorschemes. (Didn't try this
yet...)

http://www.jonlee.ca/search-for-a-256-color-vim-colorscheme/
http://www.frexx.de/xterm-256-notes/
http://www.vim.org/scripts/script.php?script_id=1349
http://www.vim.org/tips/tip.php?tip_id=1312
http://www.jukie.net/~bart/blog/20060824224842

Benjamin

Matt Wozniski

unread,
Feb 24, 2008, 6:59:36 PM2/24/08
to vim...@googlegroups.com, Br...@moolenaar.net

I spent a lot of time working on making more colorschemes available
for the terminal. The first contribution can be found at
http://www.cs.drexel.edu/~mjw452/colorschemedegrade.tar.gz (extract in
~/.vim). It provides a script that fires a function every time the
colorscheme changes, looks at the colors that that colorscheme set for
the gui, and tries to approximate them to the closest available colors
for the terminal. It has two problems, though - It requires that the
vim binary you're running have been compiled with gui support, even
though you're only using the terminal version, and it causes the
screen to flicker between the ugly colors and the good colors, since
essentially you're setting every color twice, once incorrectly,
redraw, then correctly, and redraw.

In order to get around those two issues, I spent a lot of time writing
a patch (see http://groups.google.com/group/vim_dev/msg/01b3def9b96e9457
for the patch, or http://tinyurl.com/2ejfh4 for the description and
rationale behind it), but never got any feedback, either from Bram or
anyone who tested it. Rather than trying to coerce old gui
colorschemes to "just work" as 256 color terminal schemes, it strives
to unify the syntax for a gvim color and a color terminal color,
making it trivially easy to convert a gvim scheme to a 256 color vim
scheme (I included a regex command in that thread that should do the
trick 99% of the time), and having vim do the work figuring out what
xterm palette number best corresponds to that #rrggbb color.

I'd still love some feedback on that patch; if you were so inclined as
to test it I would be most appreciative. Either way, assuming that
you already have vim set up for 256 color support, either of those
methods should provide an easy way to make vim colorschemes look
approximately like their gvim counterparts without trying to do the
conversion math yourself.

~Matt

Benjamin Buch

unread,
Feb 25, 2008, 3:48:23 AM2/25/08
to vim...@googlegroups.com
Hi Matt,

thanks!



> I spent a lot of time working on making more colorschemes available
> for the terminal. The first contribution can be found at
> http://www.cs.drexel.edu/~mjw452/colorschemedegrade.tar.gz (extract in
> ~/.vim). It provides a script that fires a function every time the
> colorscheme changes, looks at the colors that that colorscheme set for
> the gui, and tries to approximate them to the closest available colors
> for the terminal. It has two problems, though - It requires that the
> vim binary you're running have been compiled with gui support, even
> though you're only using the terminal version, and it causes the
> screen to flicker between the ugly colors and the good colors, since
> essentially you're setting every color twice, once incorrectly,
> redraw, then correctly, and redraw.

I tried the unpatched version of colorschemedegrade with all the
"a"-colorschemes from http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/,
and it worked quite well with the most of them!
As it seems, the vim binary is compiled with gui support, and I didn't
experience the flickering.



> In order to get around those two issues, I spent a lot of time writing
> a patch (see http://groups.google.com/group/vim_dev/msg/01b3def9b96e9457
> for the patch, or http://tinyurl.com/2ejfh4 for the description and
> rationale behind it), but never got any feedback, either from Bram or
> anyone who tested it. Rather than trying to coerce old gui
> colorschemes to "just work" as 256 color terminal schemes, it strives
> to unify the syntax for a gvim color and a color terminal color,
> making it trivially easy to convert a gvim scheme to a 256 color vim
> scheme (I included a regex command in that thread that should do the
> trick 99% of the time), and having vim do the work figuring out what
> xterm palette number best corresponds to that #rrggbb color.
>
> I'd still love some feedback on that patch; if you were so inclined as
> to test it I would be most appreciative. Either way, assuming that
> you already have vim set up for 256 color support, either of those
> methods should provide an easy way to make vim colorschemes look
> approximately like their gvim counterparts without trying to do the
> conversion math yourself.

Thank you for writing the utility, and for writing the patch. I didn't
try the patch yet though. I'm quite unexperienced with patching things
and didn't work out how to do this.

Benjamin

A.Politz

unread,
Feb 25, 2008, 6:56:34 AM2/25/08
to vim...@googlegroups.com
Benjamin Buch wrote:

>Hi,
>
>I think I've got it now.
>It's because xfce-terminal supports only 256 colors, gvim much more.
>So most vim colorschemes are created for use with gvim and thus contain
>colors which cannot be displayed in xterm.
>
>
>

It's more likely that vim doesn't know how to change
background colors in you terminal.

-ap

--
:wq

Matt Wozniski

unread,
Feb 25, 2008, 7:10:31 AM2/25/08
to vim...@googlegroups.com

No, Benjamin is right, the problem is the colorschemes themselves.
Most colorscheme authors only write their scheme for gvim, since 16
color terminals just don't have enough colors (and the colors they do
have are unpredictable), and 256 color terminal colorschemes are
difficult and time consuming to write, particularly if you intend for
them to look nearly the same on a wide variety of terminals. So, what
he's seeing are colorschemes that only decide to change the background
color when running in gvim.

It would sure be nice if someone were to write a patch that made 256
color terminal colorschemes easier to write, wouldn't it? *g*

~Matt

haron

unread,
Feb 26, 2008, 7:09:29 PM2/26/08
to vim_use
Matt, you are just Genius,

After just dropping of two files from your colorschemedegrade plugin /
lib into my ~/.vim dir my favorit GUI ps_color.vim colorscheme looks
like a charm on my Konsole as well ! !!!

Thank you very-very much.

On 25 фев, 00:59, "Matt Wozniski" <m...@drexel.edu> wrote:
> On Sun, Feb 24, 2008 at 3:59 AM, Benjamin Buch <benni.b...@gmx.de> wrote:
>
> > Hi,
>
> > I think I've got it now.
> > It's because xfce-terminal supports only 256 colors, gvim much more.
> > So most vim colorschemes are created for use with gvim and thus contain
> > colors which cannot be displayed in xterm.
>
> > However, I found some useful links on that topic. There's also a tool
> > to convert gvim colorschemes to 256-color colorschemes. (Didn't try this
> > yet...)
>
> > http://www.jonlee.ca/search-for-a-256-color-vim-colorscheme/
> > http://www.frexx.de/xterm-256-notes/
> > http://www.vim.org/scripts/script.php?script_id=1349
> > http://www.vim.org/tips/tip.php?tip_id=1312
> > http://www.jukie.net/~bart/blog/20060824224842
>
> I spent a lot of time working on making more colorschemes available
> for the terminal. The first contribution can be found athttp://www.cs.drexel.edu/~mjw452/colorschemedegrade.tar.gz(extract in
> ~/.vim). It provides a script that fires a function every time the
> colorscheme changes, looks at the colors that that colorscheme set for
> the gui, and tries to approximate them to the closest available colors
> for the terminal. It has two problems, though - It requires that the
> vim binary you're running have been compiled with gui support, even
> though you're only using the terminal version, and it causes the
> screen to flicker between the ugly colors and the good colors, since
> essentially you're setting every color twice, once incorrectly,
> redraw, then correctly, and redraw.
>
> In order to get around those two issues, I spent a lot of time writing
> a patch (seehttp://groups.google.com/group/vim_dev/msg/01b3def9b96e9457
> for the patch, orhttp://tinyurl.com/2ejfh4for the description and
Reply all
Reply to author
Forward
0 new messages