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