random colors, as distinct as possible

Hi there,

i’m working on a game that features a level generator. There are a number of things in the level, depending on the difficulty of the level.
Each of these things have their own color i’d like to randomly generate. I know I can generate colors using

var thingyColor:Color=new Color(Random.value,Random.value,Random.value)

but i don’t have a clue how to make sure that these colors are as distinct as possible. When there are only two colors, I want them to be at the opposite side of the color wheel. When I have 3 colors, I want them to be 120º away from each other etc. The max. number of thingies to generate are 20-30, I think but normal gameplay is about 3-5 thingies.

Using [ColorHSV][1], you can do this:

var colors : Color[];

function Start () {
	colors[0] = Color(Random.value, Random.value, Random.value);
	var colorhsv = ColorHSV(colors[0]);
	for (var i = 1; i < colors.Length; i++) {
		colorhsv.h += 360.0 / colors.Length;
		colors *= colorhsv.ToColor();*