Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function for creating color wheels [closed]

This is something I've pseudo-solved many times and have never quite found a solution for.

The problem is to come up with a way to generate N colors, that are as distinguishable as possible where N is a parameter.

like image 220
Louis Brandy Avatar asked Aug 01 '08 18:08

Louis Brandy


People also ask

What is the function of a color wheel?

The color wheel is a visual representation of the primary colors and how they combine to create all other visible colors. The color wheel is helpful for understanding the relationships between colors for art, design planning and color schemes.

What was the main process of making a color wheel?

Here is a simple process for making your own color wheel: Step 1: Draw an outline of a simple color wheel on a canvas board or some other surface. Step 2: Paint in the primary colors (red, blue and yellow). You should use the highest chroma primary colors which you have.


1 Answers

My first thought on this is "how to generate N vectors in a space that maximize distance from each other."

You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at Random Point Picking. Once you have a set of vectors that are maximized apart, you can save them in a hash table or something for later, and just perform random rotations on them to get all the colors you desire that are maximally apart from each other!

Thinking about this problem more, it would be better to map the colors in a linear manner, possibly (0,0,0) → (255,255,255) lexicographically, and then distribute them evenly.

I really don't know how well this will work, but it should since, let us say:

n = 10 

we know we have 16777216 colors (256^3).

We can use Buckles Algorithm 515 to find the lexicographically indexed color.\frac {\binom {256^3} {3}} {n} * i. You'll probably have to edit the algorithm to avoid overflow and probably add some minor speed improvements.

like image 123
nlucaroni Avatar answered Sep 24 '22 15:09

nlucaroni