你可以使用HSL颜色模型来创建颜色。
如果你想要的只是不同的色相,并且亮度或饱和度略有不同,则可以像这样分配色相:
// assumes hue [0, 360), saturation [0, 100), lightness [0, 100)for(i = 0; i < 360; i += 360 / num_colors) { HSLColor c; c.hue = i; c.saturation = 90 + randf() * 10; c.lightness = 50 + randf() * 10; addColor(c);}


