Tom Miller's Blog

The Ramblings of Miller. These postings are provided "AS IS" with no warranties, and confer no rights.

Why CornflowerBlue?

Why CornflowerBlue?

Rate This
  • Comments 6

This post will be purely speculation by me! 

Take a time travel machine back in time to early 2003.  It might have even been late 2002, but I think it was 2003. I was coming up with the concepts and code that would eventually be my first kick start book, and was rendering everything on a bland black background.  For some things, black makes sense, but it's hard to see shaded objects (and particular shadows, etc) on black objects.  Black in general is a horrible color to use as a clear color.  If you clear your scene to black, then render a model and see nothing but black, what went wrong?  Was the model not drawn because your camera is facing the wrong way?  Was the model drawn, but not colored because your pixel shader wasn't set?  You could tell the difference if your background wasn't black.

I needed something brighter, and white was out of the question.  I can stare at a white screen all day as I type text, but a white background with a single 3D object on it is just too contrasting and is ugly in my opinion.  So i needed a color that was light, but not too light, dark, but not too dark, and it needed to be something that I would feel comfortable using for just about anything.

So, as I was inside visual studio, I typed "System.Drawing.Color" then hit the extra period and started scrolling through intellisense, stopping at ones that sounded promising and trying them out.  I eventually narrowed it down to a light shade of blue.  I had narrowed my choice down to "LightBlue" "DodgerBlue" "PowderedBlue" "RoyalBlue" and "CornflowerBlue".  For various reasons I eliminated a couple more and came down to a list of three left.

I had to choose between CornflowerBlue, RoyalBlue, and DodgerBlue.  I tried various models on each of the background colors, and finally decided that RoyalBlue and DodgerBlue were too "bold" and contrasted too much, but CornflowerBlue was a much more "calm" color, and everything I tried looked good against it.  Plus who wants to use a color called "RoyalBlue" or "DodgerBlue" when "CornflowerBlue" is such a cooler name.

If you've read my Kickstart book, the vast majority of sample code in there clears all of the backgrounds to CornflowerBlue.  Every sample I've written since that point in time does as well.

Can I say with any sense of certainty that everyone else uses it because I did way back then?  Probably not, I'm sure there are people who haven't even read that book!  At times though, I like to delude myself and think I started the craze way back then. =)

  • PingBack from http://msdnrss.thecoderblogs.com/2008/02/27/why-cornflowerblue/

  • Nice story.

    "Cornflower blue is also the default clear-screen background color in Microsoft XNA, possibly a reference to the movie Fight Club (this reference is denied by the XNA team who just thinks that cornflower blue is a pretty color)." ???

    http://en.wikipedia.org/wiki/Cornflower_blue

  • Finally I have a link when people ask me about this... and its surprising how many people ask why...

  • Tom,

    Let's not forget that the old Emacs and X-Window docs/examples frequently used "cornflower-blue" as an example color.  

  • Tom, I sure wish you would do an XNA Bible book or something.  Your kickstart and beginning 3D books got me hooked on managed game programming. :) Yes, I have Chad's book, but I think you could do better. :)

    Oh, and congratulations on XBOX Live Community Games.  XNA is at the heart of it, and it never would have happened with you.  You deserve a big fat achievement award, or something, from Microsoft. :)

  • Nah, any fan of the movie Fight Club would instantly respond "CornFlowerBlue" if asked for a colour.

Page 1 of 1 (6 items)