[thelist] How to Make a Set of Different Random Colors

Svend Tofte svend at svendtofte.com
Thu Aug 14 08:23:27 CDT 2008

2008/8/14 Fred Jones <fredthejonester at gmail.com>:
> I am making charts on the fly but all data is dynamic, including the
> number of elements. How can I generate nice colors so that each slice
> of the pie chart will be a different, unique, yet BRIGHT color? I am
> using this now:

You can also consider inverting the colors (ie, 00FFB2 becomes
FF004D). As long as one of the primary components is FF, inverting it
will create a "full" color, on the opposite side of the RGB spectrum.
This only doubles a color, but it's easy to see where you can take
this. But I'm curious, before I spend some more time on this, what are
the color restrictions (if any)? You could for instance, segment the
color wheel into say, 10 chunks (if you need 10 distinct colors), but
considering the rainbow look, is this what you want? I'm thinking you
can use a radix, and some simple power functions to represent the
individual colors. But still, consider the approaches listed here:

For generating "similar" colors. If you truly don't care about color,
splitting the color wheel will provide the largest amount of "rich"
(ie, one primary color, and mixed levels of another primary) color.

At least, that's how it looks from a cursory glance!


More information about the thelist mailing list