Sunday, August 21, 2011

Re: about Vim's builtin color names -- seeing a dff on X11 ver, vs. Win ver in 1 color

On Sat, 20 Aug 2011, Linda W wrote:

>
>
> I was noticing the difference in colors when I edited on Windows vs.
> Editing over X.
>
> [...]
>
> One color stands out as different -- [...]
>
> The color is "Light Blue". [...]
>
> under X11 a color value of 0xADD8E6 - which is also the value on the
> wikipedia page of colors @
> http://en.wikipedia.org/wiki/List_of_colors.
>
> [...]
>
> On Windows, what I'm seeing for lightblue is A0A0FF,
>
> [...]
>
> So is there a file I can change to fix that, or is it builtin to vim?
>
> If it is builtin -- why would it use a different value for the Gvim on
> Windows vs. the Gvim on X...? (Note, both of these were displayed on
> the same monitor, so it wasn't a monitor diff.

Even under X11, those colors are configurable. They're all listed in a
file called rgb.txt, whose location is configurable (see `man X` under
the section 'COLOR NAMES'), but often:

/usr/lib/X11/rgb.txt

Vim only falls back to its own version of rgb.txt when necessary (which
includes "running under an environment other than X11", AFAIK). In the
Vim source, src/gui_w48.c (Win16 + Win32 = Win48 ... ha), there's
actually a hard-coded set of color names, which includes:

{"LightBlue", RGB(0xA0, 0xA0, 0xFF)},

So, there's your problem. It also shows later on that it will look in
$VIMRUNTIME/rgb.txt, but that's never reached because LightBlue is
hard-coded.

The version of Vim I've got under Windows is Vim 7.3e (one of the last
7.3 beta versions). Its rgb.txt is at:

C:\Program Files (x86)\Vim\vim73e\rgb.txt

(the part that will change is the 'vim73e' directory. It's not under
'vimfiles', it's under the version-specific directory.)

In its header, it lists its CVS/RCS-style date as 94/02/20, meaning it's
over 16 years old. It contains entries:

173 216 230<tab>light blue
173 216 230<tab>LightBlue

173 (decimal) = 0xAD (hex)
216 (decimal) = 0xD8 (hex)
230 (decimal) = 0xE6 (hex)

So, it's got the "correct" 0xADD8E6 that you want. But it's not used.

Is there any reason not to use the $VIMRUNTIME/rgb.txt versions of those
colors? If there's some inefficiency with reading that file, maybe it
makes sense. Nonetheless, sending a patch to vim-dev to update the
hard-coded values to match the included runtime/rgb.txt values.

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: