1. ## calculating colors

Is there a formula that can be used to calculate an RGB colors complementary color? example: Plug ff0000 into the formula and get a result of 00ff00.

2. http://www.colormatch.dk/

I think one of the 6 colours is the complementary

And the formula? I guess it can be found somewhere in the javascript

3. Hmm, maybe it's just y = 255 - x for each value R, G and B?

4. Eurgh - doesn't work on any proper browsers....any good cross-browser options?

5. Originally Posted by jofa
Hmm, maybe it's just y = 255 - x for each value R, G and B?
Yep, I was right
How to calculate complementary colours: the sum of value pairs must be 255 (=FF)
Example: 003366 vs. FFCC99

Well, I think I was right... Asked my wife, who is an art teacher, and then a long discussion on simultaneous contrasts etc followed, and I was completely lost

This site has a lot of colourful info:
http://www.ncscolour.com/engelsk/main.asp

6. Nice discovery, jofa. I cooked up a quick Python function that can be adapted to whatever language you use.
Code:
```def complementaryColor(hex):
"""Returns complementary RGB color

Example:
>>>complementaryColor('FFFFFF')
'000000'
"""
if hex[0] == '#':
hex = hex[1:]
rgb = (hex[0:2], hex[2:4], hex[4:6])
comp = ['02%X' % (255 - int(a, 16)) for a in rgb]
return comp.join()```

7. Nice

8. There's also a wealth of javascript color stuff in Eric Meyer's Color Blender(released under a Creative Commons license) for the borrowing.

9. Originally Posted by anode
There's also a wealth of javascript color stuff in Eric Meyer's Color Blender(released under a Creative Commons license) for the borrowing.
Yay, and it plays with Firebird (as you'd expect from Meyer)

10. Thanks for all your input!

11. Hmm, maybe it's just y = 255 - x for each value R, G and B?
I don't this works.
Example: The complementary color for red (FF0000) is green (00FF00). Using this formula you would get 00FFFF for the complement of red.

12. Originally Posted by kenbusby
I don't this works.
Example: The complementary color for red (FF0000) is green (00FF00). Using this formula you would get 00FFFF for the complement of red.
Is green the complementary colour to red?
I think a green-blue colour is more correct

http://www.color-wheel-pro.com/pics/complementary.jpg

13. Well then, I'm really confused. I have a pocket color wheel I purchased at WalMart that indicates green is complementary to red, blue-green is complementary to red-orange????

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•