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

How it Works »New Instructable »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

Arduino Candygrabber

by
odvratno.zgodan

The Reusable and Wireless Igniter

by
nodcah

RGB LED Color Selector

by
CarlS

Arduino Flashing LEDS

by
waterlubber

Sound Activated 4 X 7 RGB LED Matrix

by
jwflammer

RGB Binary Clock

by
josegarcia.xo3e

Twitter Mood Light - The World's Mood in a Box

by
RandomMatrix

Python programming tutorial (Python 2.7)

by
Sorunome

FEATURED CHANNELS

Let your inbox help you discover our best projects, classes, and contests. Instructables will help you learn how to make anything!

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.