# opposite of a binary color?

i want to find the opposite of a binary color value....i want an easy way prefferably...and yes, i searcher googl... o the binary is 22a61b

i want to find the opposite of a binary color value....i want an easy way prefferably...and yes, i searcher googl... o the binary is 22a61b

active| newest | oldest^{goes to show what i know about colors....:P}To find the complementary ("opposite") color, you need to know some color theory and use a proper color wheel to find the coded color, identify its antipode, and then determine the RGB code for that result.

The basic theory for RGB is simple: each base color is the complement of the sum of the other two: R is complementary to G+B, G to R+B, and B to R+G. In terms of hex codes, this means:

0x000000 complements 0xffffff

0xff0000 complements 0x00ffff

0x00ff00 complements 0xff00ff

0x0000ff complements 0xffff00

For other intensities of the pure base colors, just take the ones-complement (== 0xff-value) of the color, and apply that to the other two; thus, a pale red 0x7f0000 would have the complementary value 0x008080 (since 0xff-0x7f = 0x80).

So far, so good. Unfortunately, for an arbitrary color mix as you have, you cannot just decompose it into the three primaries and complement them, since each complement has two components. You'd end up with a sum with entries above the maximum value of 0xff. As I noted above, you really need a color wheel (or some simple color software) to do this more complicated work for you.