Using the XKCD color survey for something useful

4. mai 2010


I just installed Moonlight Preview 7 in Ubuntu and the color picker almost works. :-) You can browse the colors and select some, but searching doesn't work properly.


XKCD just published the results of a survey where people would try to name a bunch of colors. The result, published here, is fun to read and for me it was really inspiring.

One of the data sets that were published was a list of popular color names along with their equivalent HTML color values. Since playing with colors is fun, I decided to take this list and turn it into .Net color constants. In .Net you have lots of defined color constants like Color.Blue and Color.Cornsilk, but even the creative ones are not as interesting as the colors Vomit (brown/green), Dark Periwinkle (a bluish color), Battleship Grey (grey like a battleship) or BabyShitBrown (don't ask). 

Interesting colors

The result is the XKCDColors class. I made two versions, one that returns System.Drawing.Color values and one that returns System.Windows.Media.Color values. The first is used with the System.Drawing namespace and WinForms applications, while the second is used for WPF and Silverlight applications.

To visualize the colors I created a tiny Silverlight 4 application that lists them all. Open it here.

And if you want to download the color files you can find them here: (20.47 kb)



After a suggestion from Randall Munroe himself I added a search box to the application. Now you can enter the hex notation for a color and get out the closest named color.

kick it on

.NET, Silverlight, WPF , ,


04.05.2010 22:31:34 #
Creating color definitions from the results of the XKCD color survey

You've been kicked (a good thing) - Trackback from
04.05.2010 22:43:15 #
Awesome! I read the XKCD post earlier today, and it's pure WIN that you already have turned this into something (somewhat) useful!

The next step will def. be to implement a XKCD color provider for the project Smile

- Jonas
16.05.2010 10:58:03 #
So basically you've created two different things, both of which have no use whatsoever in a Microsoft-free environment? Way to go. People like you are holding up progress since the 80's.
16.05.2010 21:36:02 #
@Mr slashdot contributor: You have a point about this not being useful - I completely agree with you there. Both the color constants and the Silverlight tool are essentially useless tools. But you are wrong about it not being usable in a microsoft-free enviroment.

First, Silverlight runs on both Windows and Mac OS and some mobile platforms. Soon it will run on your blu-ray player and mobile devices as well. In addition you have Moonlight that runs on Linux. I haven't tested the color picker there, but it should run well - at least if I recompile it for Silverlight 3.

On top of that you have not only the regular Microsoft .Net framework, but also alternative implementations like Mono and Portable.NET. The constants that return System.Drawing.Color values should run perfectly fine here.

So both the classes and the color picker are quite usable in a Microsoft-free enviroment. Did you even try to run the color picker? My logs show that you are running Mac OS X, so it should be easy to use on your computer.
17.05.2010 20:27:47 #
I don't know if it's a problem on my end or not, but I keep getting weird glitches with your Silverlight color-picker application.  When I click on certain colors, it'll jump to the wrong color.  So far I've had it happen with BloodRed (jumps to NeonGreen), Teal (jumps to Cerulean), NightBlue (jumps to Blue_Green), and DarkAquamarine (jumps to Blue).
17.05.2010 20:59:31 #
@Idran: Hi there and thanks for noticing this. I was in the progress of fixing another bug, and I think I fixed this one as well. The new version is uploaded if you care to try again!
17.05.2010 21:03:48 #
Afraid not, it's still happening for me on the same colors as before.
17.05.2010 22:19:33 #
@Idran: Really? It's still there?
Try to force your browser to reload the application. It probably has the application cached. When you have the application open in your browser, hold down the shift button and click the reload button on the browsers toolbar.
17.05.2010 22:51:00 #
Already tried that, but I just tried opening it in IE and it worked fine (was using it in Firefox), so maybe it's just not re-downloading the application when I force a refresh for some reason.  Whatever the reason, it seems to work fine for me in IE.  Thanks for getting to it so quick!
17.05.2010 23:14:21 #
That's interesting. I'm running it in Firefox myself and the updated version appears to work properly.

Anyway. Thanks for testing!
Ben in Seattle
Ben in Seattle
01.06.2010 15:41:44 #
In addition you have Moonlight that runs on Linux. I haven't tested the color picker there, but it should run well - at least if I recompile it for Silverlight 3.

Just for kicks, I installed Moonlight on my Deban GNU/Linux box (sudo aptitude install moonlight-plugin-mozilla).  The color picker will not run. Instead I get a nice, glistening logo telling me to install Silverlight.

To double check that I'm able to run Silverlight applications at all, I viewed the "Windows Vista Simulator" here: .  It works perfectly.

--Ben in Seattle

01.06.2010 15:58:15 #
I suppose the main problem is that the app is compiled for Silverlight 4. I will try to recompile it in Silverlight 3 and upload that.

Thanks for trying it out!

19.07.2010 15:25:21 #
Regarding moonlight... does anything actually work with moonlight? when I open the link I get a window that uses 100% of a CPU and doesn't paint itself. This is only slightly less successful than my attempts to watch the CTV streaming of the winter Olympics, which were restricted to Silverlight (in that case I got a window that used 100%, sometimes 200%, and at best gave me 3 or 4 fps of video). So, Moonlight is now 0 for 2 on things I have encountered that use Silverlight.

FF 3.3.6, Moonlight 2.99.03, Ubuntu 10.4 86_64.
20.07.2010 05:52:52 #
Using the XKCDColors class, I re-worked the color descriptions into R-G-B decimals for use in The GIMP.

Download this, then (as root) copy to /usr/share/gimp/[GIMP version]/palettes/.

To see the palette in action, launch The GIMP, create a new image, then select Windows/Dockable Dialogs/Palettes. The XKCD palette will show up in the list.
20.07.2010 09:01:25 #
@gus3: Cool! I downloaded the palette and it works perfectly. Smile You might want to change the ordering of the colors so that similar colors are grouped together. I see that you used the ordering from my source files. Here the colors are ordered by popularity so the most popular names are first in the file.
20.07.2010 09:04:28 #
@Greg: I haven't used Moonlight much myself, I only run Linux on my netbook, but I believe it should play well with the major video streaming services.
The versions supporting Silverlight 3 and 4 are still in alpha versions, so we can't expect them to be stable yet.
20.07.2010 16:32:30 #
If I re-order the palette, it will be by HSV. Maybe this afternoon, if I can get a working RGBtoHSV conversion going.
21.07.2010 03:16:32 #
The color palette at is now sorted by HSV. Visual search is much easier on the eyes.
07.08.2010 15:50:04 #
Anyone dare to make an OS X color-picker plugin?
08.08.2010 16:13:54 #
@.jon: Silverlight works on OS X, so the application should work there as well as on Windows and Linux.
27.01.2011 21:35:29 #
If you are on windows or on mac then Silverlight is available in most (all?) browsers. It is only in linux that you have to use Moonlight.

Add comment

  Country flag

The number (5) not with letters. This is to stop spammers.

  • Comment
  • Preview