1078Views10Replies

# 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

1078Views10Replies

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

## Discussions

Best Answer 9 years ago

In fact, I have just figured out that my complicated algorithm below is silly. The correct answer is really simple -- the visual complement to any RGB color is exactly the ones complement of that color code! So, for your example of 0x22a61b, the complement would be 0xffffff-0x22a61b = 0xdd59e4.

9 years ago

That's a Hex color, not binary.

Answer 9 years ago

oh, ....

^{goes to show what i know about colors....:P}9 years ago

Look up "RGB color table" on Google (i.e., not "binary"). The hexadecimal (base sixteen) code you posted above, 0x22a61b, consists of three single-byte values: 0x22 is the red (on a scale from 0 to 0xff=255), 0xa6 is the green, and 0x1b is the blue.

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.

Answer 9 years ago

In fact, I have just figured out that my complicated algorithm above is silly. The correct answer is really simple -- the visual complement to any RGB color is exactly the ones complement of that color code! So, for your example of 0x22a61b, the complement would be 0xffffff-0x22a61b = 0xdd59e4.

Answer 9 years ago

hrmphh...i cant select this one as best answer...o well....(and yes, i did uncheck the original)

Answer 9 years ago

That's because I replied to myself. "Best answer" can only be chosen for top level. I'll repost at the top level and select it, based on your comment here.

9 years ago

Huh. You claimed "I searched Google". Clearly not very much. I put in "color table complementary" and the second hit was a tool to do exactly what you want. Go find it yourself.

Answer 9 years ago

sorry, i didn't know what to look for...i tried opposite of binary color on google, and not much came up....thanks though!

Answer 9 years ago

Hmmmm...the Web site name is "opposite color tool". I just ran it with your example, and the result is quite interesting.