Thursday, November 5, 2015

Secret knowledge and the magic of color

Today's project is css.  Conceptually, it's pretty satisfying to see how the sausage is made.

One piece addressed in passing in the codeacademy track is hexadecimal color notation.  (For those who don't know, you can specify an exact color using a six-digit number, with each digit being 0-9 or a-f.)  The tutorial gave a few examples of different colors (#000000 is black, #FFFFFF is white, etc).
As different color codes were used on different exercises, I started wondering who decided which colors went with which code.  Was it a committee?  The first coder who designed the system? Coding and the physical sciences share a feature here: whoever got there first got to name things.  Or, to be more precise: whichever representative of the Western science paradigm got there first was able to pick the words that other people of the same paradigm used.  The people already living in the area probably already had a perfectly suitable name for the thing, after all.

The result is a system that is partially logical and partly arbitrary.  When you're a beginner in any field it can be difficult to tell a priori which things have a reason and which are "because fuck you, that's why."

One benefit of a life time in science is developing a well-honed intuition for the inner logic of classification schemes.  The color hex code seems arbitrary at first glance.  What naturally connects numbers and colors, after all?

The connection, of course, is the pixels on your screen.  Each pixel needs to be an exact color, and the technology is such that each pixel is a blend of three colors: red, blue and green.  Two of the six digits in the color code signal the intensity of red, two signal intensity of blue, and two for green intensity.  White light is composed of all three at equal intensity.  Black pixels have all three at zero intensity.  This article, the first result when you ask google for "logic of hex color names," lays it out simply and beautifully.

Yes, that's all basic color theory and I'm sure it's painfully obvious for some.  It's not something I'd ever come across independently.  Or so I though until I remember shopping for a second monitor.  Curiously, many offered "true rRGB" with 16,777,216 colors. That seemed an oddly specific number of colors, but wrote it off as another of those artifacts. 16,777,216 is also 16x16x16x16x16x16...which is all the possible combinations of the 6-digit hexadecimal color code. It's also 24 bits (=2^24)

As excited as I am for new trivia, the deeper discovery is that my own intuition is still working.  It's disorienting to be in a new field and learning new terminology and new patterns of thinking.  It feels good when the patterns start to appear.

No comments:

Post a Comment