## In a Fix

21 December 2011

I collided yester-day with Brouwer's Fixed-Point Theorem while writing a program that aids artists in creating on-line web galleries.

There's a notion in art of complementary color. The lighter a color is, the darker is its complement, and v.v.. And, if one locates a color on a color wheel, this complement is its diametrical opposite on the wheel. Complementary colors are used, well, to complement things. So, for example, a dark red object is thought to look best against a light green background (if one uses the classic red-yellow-blue color system) or against a light turquoise background (if one uses the red-green-blue system).

I thought (and think) that it would be a fine thing if an image should be automatically displayed on a page whose background color were the complement of the average color of the image. In keeping with this complementarity, it might seem to be a good idea for the page text to be the complement of the background, which is to say that original average color. Well, here is where Brouwer pokes his head in the room and suggests a problem.

Brouwer's Fixed-Point Theorem tells us that every continuous function f from a closed ball onto itself has a point x such that f(x) = x. A color wheel is a closed ball in two dimensions. Grey-scale is a closed ball in one dimension. Half-way between black and white is a shade of grey which is its own complement. The color dead-center on a color wheel is its own complement. So the center of the cylinder formed by the Cartesian product of light-and-dark with the color wheel is its own complement. And any colors near this center have their complements also near this center, which means that there isn't enough contrast for real usability. Color schemes such as medium grey text on a medium grey background just don't cut it.

I don't know what the best adjustment is; I'm not even sure that there is a unique best to be found. But I believe that the proper adjustment would be to alter the lightness — and only the lightness — of the foreground text, making sure that it were different from that of the background by increasing any existing relative difference. (In cases were the brightness is dead-center, a movement in either direction should be fine.)

Tags:

### 4 Responses to In a Fix

• Gaal Yahas says:

If you enjoy the benefit of hindsight, you can pick a color model that doesn't have a fixed point where you care, based on the actual input in question. If the input is greyscale it is one dimensional in a strongly conventional model, but rotate the model arbitrarily(*) and then (for example) you get a greenish background for some inputs, mauve for others, etc.

(*) You will remember that color is not a wholly objective effect. Some color perceptions are created by the eye and not by any single wavelength (e.g., magenta). Others can be triggered by several different combinations (e.g., green). There are also physiological differences among viewers. So your problem requires a conscious judgment from you, and that's all right.

• Daniel says:

But the point here is to satisfy users who will typically not be me. (Indeed, because most are so used to a red-yellow-blue system, I have the complements computed on such a color wheel, though that means converting everything from RGB and then back again.) Although I will probably be one of the users in future, I doubt that I would have undertaken to automate the complementation were I the target user.

• Gaal Yahas says:

BTW, since you're translating anyway, consider finding your complements in Lab space instead of HS{VLi}. http://en.wikipedia.org/wiki/CIELAB .

• Daniel says:

Lab space might indeed be a good place to do some of these things.

Right now some of what I am doing is just plain kludgy, but early in-process I got a copy of Measuring Colour by R. W. G. Hunt. I'm hoping that, after I've read it and perhaps some other things, I will produce more satisfactory transformations.

But I'm really seeking complements as defined by a historical system, rather than as determined more objectively by the process of vision.

This site uses Akismet to reduce spam. Learn how your comment data is processed.