[thelist] The use of color (was site header and logo)

Ben Henick persist1 at io.com
Sun Dec 30 16:06:33 CST 2001


On Sun, 30 Dec 2001, Alliax wrote:

> Heather, I too, am interested in the use of colors, even if I haven't much
> theory to base myself on.
> In my sites I tend to use randomness to choose colorization
> I choose randomly the base color, then I change the luminosity for others
> gradients.
>
> I'd like to know a simple algorythm to pass from an RGB value
> R = 0-255
> G = 0-255
> V = 0-255
> to its complementary color.

Well...

Photoshop's invert command just does the following to each pixel:

Inverse == (255 - Orig)

If you're looking to preserve saturation and brightness, the easiest
approach is simply to put in the value into Photoshop's color picker that
is 180deg removed (Image > Adjust... > Hue/Saturation also works for this
purpose.)

There is a way to do it, though I don't know what it is...

I found some Java code here:

http://www.examsky.com/jglossh.html
[under 'HSB']

that might provide a few clues, as might this list of links:

http://www.efg2.com/Lab/Library/Color/Science.htm

The Google search I used to find these links was 'rgb hsb convert formula'
(no quotes, of course).

> I've read somewhere that I should transform RGB into HSV and then make some
> angles rotation and then convert back to RGB.
> I have no idea what HSV is yet, but would you know of a simple way of
> obtaining the complementary color from a RGB color ?

All right, for follow-up's sake:

H = Hue (where is it on the color wheel?)
S = Saturation (the closer to grey, the less saturated)
B = Brightness (do I have to explain this? also referred to as Value -
    which actually belongs to a different model if I understand correctly)

Actually, I took a second look and found this (as written in C, I think):

http://www.cs.rit.edu/~ncs/color/t_convert.html

The HSB model works as follows (in this instance, I'll use percentages
for all three values):

If your Hue value is 0% or 100%, the color produced is red.

If it's 50%, the color produced is cyan.

Thus 33% would be green, and 67% blue.

A more detailed explanation of this can be found at:

http://webdesign.about.com/library/weekly/aa111201a.htm

A Saturation value of 0% will always be on the greyscale; if your
Saturation value is 100%, the corresponding RGB value will have at least
one channel with a value of zero.

When Brightness is set to 0%, the result is (always, regardless of the
other values) black; if it's 100%, the corresponding RGB value will have
at least one channel with a value of 100% (255).

These statements are easy (and perhaps even fun) to test with the color
picker of your favorite graphics software.


HTH
-- 
Ben Henick
Web Author At-Large              Managing Editor
http://www.io.com/persist1/      http://www.digital-web.com/
persist1 at io.com                  bmh at digital-web.com
--
"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"





More information about the thelist mailing list