nextColorHsl method

HSLColor nextColorHsl({
  1. double? hue,
  2. double? saturation,
  3. double? lightness,
  4. double? alpha,
})

Generates a random HSLColor with uniformly distributed hue, saturation, and lightness values.

You can optionally specify some components of the generated HSLColor.

Implementation

HSLColor nextColorHsl({
  double? hue,
  double? saturation,
  double? lightness,
  double? alpha,
}) {
  final h = hue ?? nextDouble() * 360;
  final s = saturation ?? nextDouble();
  final l = lightness ?? nextDouble();
  final a = alpha ?? nextDouble();

  return HSLColor.fromAHSL(a, h, s, l);
}