tags:

views:

74

answers:

1

Is there a good way to iterate over colors? I know it sounds like a strange question but here's an analogy.

Suppose you write a game where you travel around the Earth. You pick a starting point and then you define a rule that you apply repeatedly. For example: Start at your current location on Earth and then define the great circle that goes through your location and the North and South poles. For every step, travel 10 miles along this circle. Each step takes you to a similar climate as the one before (although sometimes you're awfully wet because you're in the ocean). Or travel 6,000 miles for each step. Now each step is a very different climate.

Now imagine a program that draws elements on the screen with random colors. Maybe you set the increment to a low number, and each color is very similar to the one before. Maybe you set it high, and each color is very different from the one before.

If you use RGB values and increment the R, G and B each by a small amount you get gradual changes until one of the values wraps and you get a sudden change.

With HSB values, the gamut of Hues is circular, so there is no discontinuity. S and B are not, and you may run into a stretch of indistinguishable colors because S is so low that they all look white. Keeping S and B at max is a possibility, although it leaves out a lot of colors.

Each run of the program uses only a small number of colors (10 to 15). I would like to pick values at random so that one time the colors blend harmoniously, one time they clash, one time they are all pastels, one time they are a mix of saturated and pastel, etc.

+1  A: 

If you draw a color wheel, you can get complementary colors by selecing from the opposite side of the color wheel.

Here's an page that has several variations on that idea, and a nice interactive application to explore them.

http://colorschemedesigner.com/

Mark Harrison