/// <summary> /// Gives a list of colors where that maximises distance on /// the gradient between consecutaive colors. /// </summary> /// <param name="colorCount"></param> /// <param name="gradient"></param> /// <returns></returns> public static List<ColorHSL> GenerateColorsGoldenRatioGradient(int colorCount, GradientHSL gradient) { var colors = new List<ColorHSL>(); var t = Random.value; for (int i = 0; i < colorCount; i++) { var newColor = gradient.Evaluate(t); colors.Add(newColor); t += GoldenRatioConjugate; t %= 1.0f; } return colors; }
/// <summary> /// Generates a list of colours randomly sampled from a gradient. /// </summary> /// <param name="colorCount"></param> /// <param name="gradient"></param> /// <returns></returns> public static List<ColorHSL> GenerateColorsRandomGradient(int colorCount, GradientHSL gradient) { var colors = new List<ColorHSL>(); for (int i = 0; i < colorCount; i++) { var color = gradient.Evaluate(Random.value); colors.Add(color); } return colors; }