Swap colors/color components Dialog Box

This is a dual purpose dialog box, because it performs two completely different, but related, operations.

Both operations are useful for changing the colors of things; you could use this dialog box, for example, to doctor a picture of hockey jersies to make it look like some other team, or maybe to change the color of some people's skin to green and call it an alien invasion.

The first operation is swapping two colors, or two ranges of colors. The top half of the picture on the right illustrates this.

For example, you could choose a shade of magenta for the first color, and any colors between a shade of turquois and light blue for the second color (As the picture shows). Then, when you click "Apply", one of two things will happen:

For both the first color and the second color, there are two modes of color matching, which can be set independantly:

Side Effects

The color matching algorithm is sometimes a bit more liberal at finding matches than you want, and sometimes a bit more picky than you want—particularly when using a two-color range. For example, if you choose pure bright red (255,0,0) and pure dark green (0,128,0) as your two colors, the algorithm will also match black, certain shades of dark yellow and orange. How is this possible, you ask? After all, these colors are nowhere close to red or green! Meanwhile, a light shade of green will NOT match, even if it seems very close to the green you chose; nor will any grayish versions of green or red match.

The reason lies with the fact that, for matching purposes, all colors are divided up into their primary color (red, green, and blue) components and compared separately. So if your two colors are bright red (255,0,0) and dark green (0,128,0), Then, anything with a red range of 0 to 255, a green range of 0 to 128 and a blue value of 0 will match. This includes pure dark yellow (128,128,0) and pure black (0,0,0), but any color that is not completely saturated (e.g. gray-green or gray-red) will not match because it has a nonzero blue value.

Swap mode when the color ranges overlap

If you choose two color ranges that overlap (for example, a range of black to white matches every possible color and will therefore overlap the other range no matter what), the first range will take precedent.

The second operation, swapping primary color components, can be accessed be clicking "Swap primary colors." All this does is trade one primary color with another. For example, if you choose Red and Blue, then those two primary colors get swapped. For example:

Swapping one primary color with the other two

This swaps a primary color with the average of the other two. For example, if swapping Blue with the other two, and a given pixel is (64,128,192) — a shade of bluish-turquois:

Thus, the new color becomes (192,192,96) — a shade of grayish-yellow.

Experiment with it and have fun.