Loading ...
Sorry, an error occurred while loading the content.

Color.plist rgb values are wrong (fix attached)

Expand Messages
  • 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
    Message 1 of 7 , Feb 24, 2009
    • 0 Attachment
      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.

      Best regards,

      Zvezdan

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • björn
      ... 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
      Message 2 of 7 , Feb 25, 2009
      • 0 Attachment
        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
        -~----------~----~----~----~------~----~------~--~---
      • björn
        ... It seems three colors that are in Vim are not included in the output of showrgb , namely: darkyellow lightmagenta lightred I have added these manually to
        Message 3 of 7 , Feb 25, 2009
        • 0 Attachment
          2009/2/25 björn:
          > 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.

          It seems three colors that are in Vim are not included in the output
          of "showrgb", namely:

          darkyellow
          lightmagenta
          lightred

          I have added these manually to Colors.plist and pushed the changes.

          Björn

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Zvezdan Petkovic
          ... Yes, I noticed that in vimdiff of the original and generated plist. However, since neither showrgb nor Wikipedia page on X11 colors list those three colors
          Message 4 of 7 , Feb 25, 2009
          • 0 Attachment
            On Feb 25, 2009, at 2:25 PM, björn wrote:
            > It seems three colors that are in Vim are not included in the output
            > of "showrgb", namely:
            >
            > darkyellow
            > lightmagenta
            > lightred

            Yes, I noticed that in vimdiff of the original and generated plist.
            However, since neither showrgb nor Wikipedia page on X11 colors list
            those three colors I thought they could be safely omitted.

            > I have added these manually to Colors.plist and pushed the changes.


            Perhaps you think they are important to maintain compatibility in case
            they were used previously in Vim?

            If you want, we can add them to the initialization part before the
            first for loop in rgb2plist.py. So, instead of starting with an empty
            dictionary

            colors = {}

            we could start with

            colors = dict(darkyellow=1234, lightmagenta=5678, lightred=90)

            putting the original numbers in, of course. :-)
            It's a small change to apply and easy to test if it works.
            Still, if you don't have time I could apply it.

            Then they would be generated from the program with all the other
            numbers. We wouldn't need to think about forgetting them in case the
            plist is ever re-generated (assuming that you committed rgb2plist.py
            together with Colors.plist to the repo).

            Zvezdan
            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Dewdman42
            I m just catching up to this thread. I see that the latest 7.2 version of Macvim seems to have the new Colors.plist values, as fixed by you guys on this
            Message 5 of 7 , Aug 9, 2010
            • 0 Attachment
              I'm just catching up to this thread. I see that the latest 7.2 version of
              Macvim seems to have the new Colors.plist values, as fixed by you guys on
              this thread. Still, what I observe is that the colors on MacVim do not seem
              to appear correctly. The white color is faded towards grey, the dark
              backgrounds are less dark, etc then what I see on other platforms.

              Am I alone on this?

              --
              View this message in context: http://vim.1045645.n5.nabble.com/Color-plist-rgb-values-are-wrong-fix-attached-tp1218910p2375106.html
              Sent from the Vim - Mac mailing list archive at Nabble.com.

              --
              You received this message from the "vim_mac" 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
            • Dewdman42
              Here is an image comparing 3 windows. I did this screen snap all at once, all three windows are appearing on my mac desktop at the same time(the windows one
              Message 6 of 7 , Aug 9, 2010
              • 0 Attachment
                Here is an image comparing 3 windows. I did this screen snap all at once,
                all three windows are appearing on my mac desktop at the same time(the
                windows one is using MS RemoteDesktop to view vim on windows).

                (see notes below)

                http://vim.1045645.n5.nabble.com/file/n2375109/example.jpg

                The left most window is out of the box MacVim with the "desert" colorscheme.
                Note the white fonts are clearly less-than-white.

                On the far right is a remote desktop connection to PC running Vim over
                there, and you can see that the background is darker, the white letters are
                brighter....on the same display.

                In the middle is a modified version of desert colorscheme that changed the
                guibg to gray14 instead of gray20 in order to get it to match what I would
                expect to see, but still you can see the white letters are not completely as
                white as they should be.

                This is with the very latest 7.2 stable 1.2 (33.3).


                --
                View this message in context: http://vim.1045645.n5.nabble.com/Color-plist-rgb-values-are-wrong-fix-attached-tp1218910p2375109.html
                Sent from the Vim - Mac mailing list archive at Nabble.com.

                --
                You received this message from the "vim_mac" 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
              • björn
                ... It s fixed in the latest snapshot, or you could try the 7.3 BETA: http://github.com/b4winckler/macvim/downloads (By the way: This problem has nothing to do
                Message 7 of 7 , Aug 10, 2010
                • 0 Attachment
                  On 10 August 2010 06:05, Dewdman42 wrote:
                  >
                  > Here is an image comparing 3 windows.  I did this screen snap all at once,
                  > all three windows are appearing on my mac desktop at the same time(the
                  > windows one is using MS RemoteDesktop to view vim on windows).
                  >
                  > (see notes below)
                  >
                  > http://vim.1045645.n5.nabble.com/file/n2375109/example.jpg
                  >
                  > The left most window is out of the box MacVim with the "desert" colorscheme.
                  > Note the white fonts are clearly less-than-white.
                  >
                  > On the far right is a remote desktop connection to  PC running Vim over
                  > there, and you can see that the background is darker, the white letters are
                  > brighter....on the same display.
                  >
                  > In the middle is a modified version of desert colorscheme that changed the
                  > guibg to gray14 instead of gray20 in order to get it to match what I would
                  > expect to see, but still you can see the white letters are not completely as
                  > white as they should be.
                  >
                  > This is with the very latest 7.2 stable 1.2 (33.3).

                  It's fixed in the latest snapshot, or you could try the 7.3 BETA:

                  http://github.com/b4winckler/macvim/downloads

                  (By the way: This problem has nothing to do with the original issue
                  reported in this thread. It was caused by the fact that MacVim used
                  to use calibrated colors, but nowadays it uses device colors like most
                  other apps.)

                  Björn

                  --
                  You received this message from the "vim_mac" 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
                Your message has been successfully submitted and would be delivered to recipients shortly.