Tuesday, August 10, 2010

When What to my Wandering Mind Should Appear?

I was in a meeting yesterday to discuss some enhancements to one of the applications on our consumer web site. One of the discussions was around the color scheme of the application, and how some of the colors don't lend themselves to quick understanding of the functions at hand. For example, on one screen, the two tabs at the top are light green and light grey. The user isn't certain whether green or grey is the active tab, so our goal is to improve usability by bringing the color scheme in line with our more contemporary corporate standards.

While the arguments were going on, my mind wandered a bit. I started to think about how colors are represented in HTML. One representation is the English word to describe the color. For example, I could tell my browser to render this phrase in bold red, or this one in italic green. However, this only gives us a few more colors than we remember from our big 64-pack of Crayola crayons that some kids had, while I had the Prang brand 8-pack. My mom was an elementary school teacher when I was a kid, and the teacher supply stores sold Prang. I always lusted after the crayon sharpeners in the Crayola 64 box, but back to topic.

Another way of representing color in HTML is using an ordered triplet of values that represent the amount of red, green, and blue to be painted on the object in question. These values are represented by hexadecimal values: 0=0, 1=1... 9=9, 10=A, 11=B... 15=F. The values can range, in traditional decimal, from 0 to 255, which in hexadecimal is represented by 00 through FF. So, in real mathematical ordered triplets, the decimal values 25, 128, and 217 would be written as (25, 128, 217). You may remember something like this in the ordered pairs you used to draw lines on a coordinate plane in high school geometry. In HTML's hexadecimal representation of the same values, you'd see this as #1980D9. The # indicates that the values coming up are a special hexadecimal value, and the browser knows to break apart the characters into chunks of two. The color represented by our randomly selected values before is this.

So I started to think. What six-letter words exist in the English language that contain only the letters A through F? What colors would they represent in HTML?

At the 10-minute break, after I visited the men's room, I downloaded a file of words used as the dictionary in Unix-like operating systems, and used this script to find the words.

if($_ =~ m/^[A-Fa-f0-9]{6}$/) {print;}

The resulting list was pretty short. In alphabetical order, they are:

Here are the colors.


I'm not sure there's any intrinsic meaning to this, but it was an interesting exercise.

1 comment:

Ahistoricality said...

One of the things I love about computers is that we can get answers when our minds wander so much more easily than before.

You should send that to Will Shortz: it's exactly the kind of puzzle he loves as a Sunday challenge.