2009/2/25 Zvezdan Petkovic:
> I am a long time Vim user, but I downloaded MacVim for the first time
> this last weekend.  One of the first things I noticed is that my color
> scheme in a syntax highlighted file did not look right.
>
> The information in :h macvim says this about Colors.plist
>
> "Apart from the system colors, it is also possible to use standard X11
> color names (see http://en.wikipedia.org/wiki/X11_color_names) which
> usually come in a file called "rgb.txt".  MacVim does not have such a
> file, instead it keeps these colors in a dictionary called
> "Colors.plist".  The key in this dictionary is the name of the color
> and the value is an RGB value of the form #rrggbb stored as an integer."
>
> First, those colors are easily accessible on every Mac with X11
> installed.  Simply run "showrgb" program (/usr/X11/bin/showrgb).
> The numbers seem to correspond to the Wikipedia article.
>
> However, it turns out those integers in Colors.plist are not right.
> Take, for example, the value for MediumAquamarine: 6737066.
>
> Now take a look at the Wikipedia page.
> The RGB numbers are 102 205 170, or #66CDAA
> The showrgb program gives the same decimal numbers for this color.
>
> Let's open a terminal and check the hex number in bc.
>
>        $ bc
>        ...
>        obase=16
>        102
>        66
>
>        205
>        CD
>
>        170
>        AA
>        ^D
>
> So Wikipedia hex value is correct.
> Let's now use bc to convert this hex value to an integer.
>
>        $ bc
>        ...
>        ibase=16
>        66CDAA
>        6737322
>        ^D
>
> Ouch. 6737322 != 6737066 (value from Colors.plist)
>
> Similarly for practically all other colors!
>
> I don't know how these numbers have been obtained, but they are simply
> wrong.  Even a simple color, such as Blue, is wrong -- 212.
> It is clear from that Wikipedia page that Blue is #FF (0 0 255).
> I mean, it's the B in RGB.  :-)
>
> Now, being someone who prefers programming to typing huge amount of
> numbers I have written the attached program to generate the *correct*
> Colors.plist using the output of "showrgb" X11 utility.
>
> I hope it gets used in the next MacVim snapshot.
>
> Attached is also the correct Colors.plist generated by that program.
> You can run the program on your Mac and compare that it produces the
> same plist.

Hi Zvezdan,

You are right that the current Colors.plist looks strange.  I don't
actually remember how I generated that file but I think I wrote an
Obj-C program which opened rgb.txt (which I must have downloaded from
somewhere) and used NSColor to convert to rgb.  Sounds rather silly
now that I think about it but that's how I am.

I will push your Colors.plist to the public repo so it will be in snapshot 44.

Thanks!
Björn

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_mac" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to