LabColor.random constructor
LabColor.random()
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 LabColor(
ColorMath.random(minLightness, maxLightness, seed),
ColorMath.random(minA, maxA, seed),
ColorMath.random(minB, maxB, seed),
);
}