OklabColor.random constructor

OklabColor.random({
  1. double minLightness = 0.0,
  2. double maxLightness = 1.0,
  3. double minA = 0.0,
  4. double maxA = 1.0,
  5. double minB = 0.0,
  6. double maxB = 1.0,
  7. int? seed,
})

Generates an OklabColor at random.

minLightness and maxLightness constrain the generated lightness value.

minA and maxA constrain the generated chromaticityA value.

minB and maxB constrain the generated chromaticityB value.

All min and max values must be min <= max && max >= min, must be in the range of >= 0.0 && <= 1.0, and must not be null.

Implementation

factory OklabColor.random({
  double minLightness = 0.0,
  double maxLightness = 1.0,
  double minA = 0.0,
  double maxA = 1.0,
  double minB = 0.0,
  double maxB = 1.0,
  int? seed,
}) {
  return OklabColor(
    ColorMath.random(minLightness, maxLightness, seed),
    ColorMath.random(minA, maxA, seed),
    ColorMath.random(minB, maxB, seed),
  );
}