I think you should be using RGB complements (in the "Light" answer). The RYB complements were from an era when people didn't know of light's primary colors being RGB. RGB complements look nicer, in my opinion. Here what some random dude named Lira had to say:
RYB is the traditional colour wheel,
used by artists. Sir Isaac Newton was
the first one to come up with this
sort of thing. And it was kind of fun.
Here, take a look:
Recognise it? It's the colour wheel
Jason Beaird used in his "Color for
Coders" article. Remember that, when
we're in kindergarten and stuff, we're
taught stuff like "Yellow plus Red
equals Orange"? It all comes from this
colour wheel, whose primary colours
are red, yellow and blue (they're
touching the darker triangle, poiting
upwards). Warm colours occupy half of
the space and cold colours the other
half. That's like a colour Yin Yang.
Almost too perfect to be true.
Indeed, it was too perfect to be true.
Scientists then find out that
biologically, it doesn't really work
that way. Anyway, after studying,
researching, analysing, chopping and
cooking colours, we ended up having
the RGB colour model, ubiquitously
present in stuff like computer
monitors, TV's and so on.
As you might be assuming, the colour
wheels are a bit different. The
opposite of "red" in the RYB colour
wheel is "green", whereas the opposite
of "red" in the RGB colour wheel is
cyan - you can test the latter by
staring at something red (focus, try
not to blink) and then looking at a
white surfice: the afterimage is cyan.
Here's an example:
That means you have two different
colour wheels to choose your colours
from. So, which one of them do you
A trivial definition of a complementary color regarding the RGB color space is as follows: given a color
(RR, GG, BB), the complement is
(FF - RR, FF - GG, FF - BB), where each component is given in hexadecimal. As an example:
color = (12, 4A, FF)
complement = (FF-12, FF-4A, FF-FF)
= (ED, B5, 00)
Adobe is using a slightly different definition from this "trivial" method of calculating complements. Perhaps it is more appeasing to the eye, or perhaps it aligns more closely with how the human eye works.
EDIT: Looking at this answer a few years later, I have to say that color spaces, monitors, and the human eye work in weird ways. This means that there is no one "correct" way to calculate complements. Your monitor can only display a certain range of colors, and the human eye is sensitive to certain colors more than others. This leads to many valid formulas to calculate complements.
As you can see, there's a fair amount of gap between 460 - 500nm, leading to a different human perception of expected color mixing than what is shown using actual scientific measurements.
I believe there are certain color spaces which allow for linear additive color mixing that matches our expectations...?
Here, I made a small quick web "app": http://jsfiddle.net/rXsAT/
Looks like someone already made a nicer version.
This is a rather complicated subject involving a bit of chemistry, biology, and physics.
Just know that additive color mixing with pigments is fairly different from light.