XyzColor.random constructor

XyzColor.random({
  1. num minX = 0,
  2. num maxX = 100,
  3. num minY = 0,
  4. num maxY = 100,
  5. num minZ = 0,
  6. num maxZ = 100,
  7. int? seed,
})

Generates a XyzColor at random.

minX and maxX constrain the generated x value.

minY and maxY constrain the generated y value.

minZ and maxZ constrain the generated z 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 XyzColor.random({
  num minX = 0,
  num maxX = 100,
  num minY = 0,
  num maxY = 100,
  num minZ = 0,
  num maxZ = 100,
  int? seed,
}) {
  assert(minX >= 0 && minX <= maxX);
  assert(maxX >= minX && maxX <= 100);
  assert(minY >= 0 && minY <= maxY);
  assert(maxY >= minY && maxY <= 100);
  assert(minZ >= 0 && minZ <= maxZ);
  assert(maxZ >= minZ && maxZ <= 100);
  return XyzColor(
    ColorMath.random(minX, maxX, seed),
    ColorMath.random(minY, maxY, seed),
    ColorMath.random(minZ, maxZ, seed),
  );
}