in reply to A way to validate a string as a color:
in thread Best way to validate a string as a color?

Your list looks a little bit short:

>perl -nE '@x=split;$seen{join(" ",@x[0,1,2])}++;END{say 0+keys%seen}' + < /usr/share/X11/rgb.txt 512 >wc -l /usr/share/X11/rgb.txt 782 /usr/share/X11/rgb.txt >

(From Slackware64 14.2)

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: A way to validate a string as a color:
by holli (Abbot) on Oct 17, 2017 at 20:55 UTC
    That's because rgb.txt contains a
    shitload
    of duplicates and probably system dependent variations. I complied with the list on Wikipedia I linked to.


    holli

    You can lead your users to water, but alas, you cannot drown them.

      Still, Slackware's rgb.txt defines 512 unique colors (and 270 dupes). The Xorg version is identical to the Slackware version.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        In fact that file contains 162 distinct color names and 261 distinct color values.
        Also my hash doesn't include all the grays. But yes, more than in my list.


        holli

        You can lead your users to water, but alas, you cannot drown them.