»

Welsh Incident

When I showed my first version of the Glass plugin to the coder that thought it impossible, I got some words of praise but she claimed a user-selectable colored rim (like some Flash version had) was still impossible. Robert Graves did not write:

"User selectable colours?"                         
                        "Mostly nameless colours,
Colours you'd like to see; but one was puce       
Or perhaps more like crimson, but not purplish."  

A stack of semi-translucent images can produce even the color #4E1609 (puce) but let’s look at the simpler example below, the color #FFAA33.

The color is created by stacking a layer that has all three colors (red, green, and blue), a layer that has the two most dominant colors (red and green) and a layer that holds the most dominant color (red), as shown in the left column. The top most layer needs to fill up red from #AA to #FF, so a 100% red layer with an opacity of #55/#FF or 1/3d is used. The layer below that will have to provide #77 parts of both red and green, but since only 2/3d will shine through the layer above it, a 100% red and green layer with an opacity of 3/2.#77/#FF is used. The last layer only needs to show #33 parts of all three colors, but it will have to shine through two layers. The third column visualizes what the end result is: the color #FFAA33.

If you think about it, for any color, three layers are enough and the opacities stays within [0,1]. So with eight rim images, one for each RGB color combination, a user-selectable colored rim can be created. Try for yourself.