3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

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

10 answers
sort by: active | newest | oldest
Apr 11, 2009. 2:22 PMkelseymh says:
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.
May 24, 2009. 4:20 PMArbitror says:
That's a Hex color, not binary.
Apr 10, 2009. 5:02 PMkelseymh says:
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.
Apr 10, 2009. 9:45 PMkelseymh says:
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.
Apr 11, 2009. 2:21 PMkelseymh says:
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.
Apr 10, 2009. 5:06 PMkelseymh says:
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.
Apr 10, 2009. 9:43 PMkelseymh says:
Hmmmm...the Web site name is "opposite color tool". I just ran it with your example, and the result is quite interesting.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!