Smell The Color 9

by James Classen

Musing about colors, and colorblindness. I’m not colorblind, but 14.5% of the human race is, along with many (but certainly not all) of our robot overlords. Anyway, by the W3C’s current recommendations, I need to meet the following criteria for color contrast. Note that I am aware these considerations may not immediately provide a solution to dealing with the various types of colorblindness, but it’s a start.

Consider colors as a typical rgb tuple, (r,g,b), where r,g,b\subset\mathbb{Z} and r,g,b\in[0,255] (there’s probably a better way to define that mathematically, but that’s what I came up with). After some fiddling with the recommendations, the gist of it boils down to the following:

299|r_1-r_2|+587|g_1-g_2|+114|b_1-b_2|\ge125000
|r_1-r_2|+|g_1-g_2|+|b_1-b_2|\ge500

The second equation is equivalent to the recommendation, provided |x_1-x_2|=\max(x_1,x_2)-\min(x_1,x_2) (a result that appears intuitive, but it’s not something I’ve proven as of yet).

Unfortunately, that’s two equations and three unknowns (assuming I pick one color arbitrarily). And to solve the equations I have to deal with the absolute values. The inequality is comparatively simple to handle. The added difficulty is that I am dealing with five colors, and each pair must meet this criteria. Granted, white and black are two of them, but that means that each of those need to be easily distinguishable from the others.

However, because, let’s call it color 0, is black, that simplifies the equations drastically:

299r+587g+114b\ge125000
r+g+b\ge500

I’ll save a great deal of the math, but here’s the result when r is chosen arbitrarily.

r\ge165
g\ge\lceil{{68000-185r}\over{473}}\rceil
b\ge{{\max(125000-299r-587g,57000-114r-114g)}\over{114}}

Not yet sure if there’s a way to yank the “max” function out of that, for instance, if one of those will always be greater than the other (doesn’t look like it). Mathematically speaking, it would be extremely nice, but a spreadsheet can easily handle stuff like that.

The reason I wound up with r\ge165, even though initially r was chosen arbitrarily, is that r255, which isn’t allowed.

Okay, time for white, the second “easy” color. I won’t go through all the steps here, just note my discoveries. I start with

299(255-r)+587(255-g)+114(255-b)\ge125000
(255-r)+(255-g)+(255-b)\ge500

And wind up with

r\le90
g\le\lfloor{{99790-185r}\over{473}}\rfloor
b\le{{\max(130000-299r-587g,30210-114r-114g)}\over{114}}

Note the change in direction of the inequality. Likewise, values of r>90 causes b<0, also not allowed.

Thing is, to be complete, I’d have to come up with four more sets of equations, for arbitrary choices of green and blue, just for white and black as the contrasting colors. And, by my calculations, as many as 48 sets for the generic cases (symmetry probably brings that to 24). And that’s just to comply with the W3C recommendations, assuming they don’t change. Colorblindness is more subtle than that, and with 8 “major” types of colorblindness (covering roughly 18.7% of the world population), this very well be insufficient. The simplest solution would be to find a bunch of colorblind people to provide their opinions. Just like when designing my website/application, I need to enlist the aid of blind folks to make sure screen readers parse the pages in a coherent manner.

So Curiosity made it to Mars without a hitch. Lots of exploration for it to do. It was slated for 2 years of operation. Let’s hope that it can exceed its expected lifetime by 3000%+ like Spirit and Opportunity. I think it’d be awesome if it were still completely operational by the time geologists make it there in person.

Meh, I always feel like I need to write more, that there’s something else I need to say, even though my readership rarely exceeds the single digits. In binary. I’ll just leave it at this. If I come up with the rest of the equations, I’ll probably post them.

Advertisements