The mathematics of TrueColor (and what it has to do with legal education)

Editor's note: This post is adapted from its original version in Jurisdynamics. Its publication in that forum predated the creation of MoneyLaw, which is arguably a better forum for expressing ideas regarding legal education. In any event, we stand again at the beginning of a school year, the most appropriate time for the sentiment articulated here.

CIE chartAugust is the cruelest month, bringing students back to the law schools, mixing memory and desire, stirring dull thoughts with fall pain.

This I remember, and this I love. Imparting visual power to an entire blog network has rekindled an old passion of mine: mathematics in motion. The mathematics of TrueColor arose in connection with website maintenance. And now footfalls echo in my memory down a passage I did not take, towards the door I now will open into the rose-garden.

I needed to redo the background in a .jpg file. "What color?" asked Microsoft Paint. "Ochre," I replied. But the oracle of Redmond understood me not. She demanded values in red, green, blue.

In despair, I asked Dr. Peter Jones, purveyor of the Web's easiest color calculator. "DDDD99," I muttered. "221 221 153," he replied.

And thus the hex was broken.

The six-digit codes designating TrueColor values represent the culmination of longstanding efforts to master the fascinating mathematics of color perception by humans in order to direct color production by machines. The graphic at the top of this post depicts the first step. The CIE (Commission International d'Éclairage) mapped human color perception onto the two-dimensional chart depicted here. Using the CIE chart, as French as the metric system but as intuitive as fathoms and furlongs, proved as easy as charting great circle routes on a flat map.

HSV coneThe CIE color chart gave way to the more geometrically satisfying HSV system for expressing color as a function of hue, saturation, and value. The HSV model resembles a cone, and slicing it generates conic sections that express some portion of the universe of visible color in a useful way. The whole enterprise is vaguely reminiscent of navigating according to spherical coordinates.

RGB color modelSo much for modeling how the human eye perceives color. How can a machine produce the 10 million different colors that the sharpest human eye can see? Coding the visible spectrum as different portions of red, green, and blue -- with each constituent color assigned eight bits of information -- yields 256 x 256 x 256 colors, or 16,777,216 in all.

The unwieldy decimal number 16,777,216 is more elegantly described as 224, or, if you insist, a binary septillion. The exponent, 24, reveals an important truth: 24 bits suffice for the expression of TrueColor. More powerful 32-bit and 48-bit systems enable transparency and sophisticated overlays that are less prone to rounding errors that would otherwise accumulate with each iteration of image filtering.

The familiar RGB (red green blue) color scheme, traceable to the awful days of the four-bit, 16-color palette of IBM's color graphics adapter, is even more helpfully expressed in hexadecimal format. Since 16 x 16 equals 256, base 16 mathematics allow us to express any value from 0 to 255 with exactly two digits. Digits 1 and 2 represent red, digits 3 and 4 represent green, and digits 5 and 6 represent blue. DDDD99 -- quite a bit of red and green, with considerably less blue -- produces MoneyLaw's background color, casually described as "ochre."

Very well then. What does all this have to do with legal education?

Long ago I ran out of digits to tally the number of legally trained professionals who have confessed bewilderment at the idea that law might -- and indeed should -- be quantified to the very limits of the power of numbers to describe the world and to prescribe how best to fix its flaws. Law school, so these individuals confessed, was the refuge from numbers, equations, graphs. Check your probability distributions at the door. We went to the law school because we bombed the GMAT, much less the MCAT.

Ah, but there lies the rose-garden. The world is filled with problems that can be expressed in numbers. If the law harbors any hope of solving them, it cannot afford to discard so basic a tool as mathematics. As undergraduates approach the LSAT, as 1Ls matriculate, as professors end their collective estivation, I offer this wish for the coming academic year. Would it be that our profession no longer confessed -- no longer cherished -- its rampant innumeracy. Would it be that the law, reunited with the tools of quantitative analysis and reinvigorated with an appreciation of mathematical beauty, might cease to be the mathematical waste land of the social sciences.