LabColor.random constructor

LabColor.random({
  1. num minLightness = 0,
  2. num maxLightness = 100,
  3. num minA = 0,
  4. num maxA = 100,
  5. num minB = 0,
  6. num maxB = 100,
  7. int? seed,
})

Generates a LabColor at random.

minLightness and maxLightness constrain the generated lightness value.

minA and maxA constrain the generated a value.

minB and maxB constrain the generated b value.

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

Implementation

factory LabColor.random({
  num minLightness = 0,
  num maxLightness = 100,
  num minA = 0,
  num maxA = 100,
  num minB = 0,
  num maxB = 100,
  int? seed,
}) {
  assert(minLightness >= 0 && minLightness <= maxLightness);
  assert(maxLightness >= minLightness && maxLightness <= 100);
  assert(minA >= 0 && minA <= maxA);
  assert(maxA >= minA && maxA <= 100);
  assert(minB >= 0 && minB <= maxB);
  assert(maxB >= minB && maxB <= 100);
  return cm.LabColor.random(
    minLightness: minLightness,
    maxLightness: maxLightness,
    minA: minA,
    maxA: maxA,
    minB: minB,
    maxB: maxB,
    seed: seed,
  ).cast();
}