CmykColor.random constructor

CmykColor.random({
  1. num minCyan = 0,
  2. num maxCyan = 100,
  3. num minMagenta = 0,
  4. num maxMagenta = 100,
  5. num minYellow = 0,
  6. num maxYellow = 100,
  7. num minBlack = 0,
  8. num maxBlack = 100,
  9. int? seed,
})

Generates a CmykColor at random.

minCyan and maxCyan constrain the generated cyan value.

minMagenta and maxMagenta constrain the generated magenta value.

minYellow and maxYellow constrain the generated yellow value.

minBlack and maxBlack constrain the generated black 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 CmykColor.random({
  num minCyan = 0,
  num maxCyan = 100,
  num minMagenta = 0,
  num maxMagenta = 100,
  num minYellow = 0,
  num maxYellow = 100,
  num minBlack = 0,
  num maxBlack = 100,
  int? seed,
}) {
  assert(minCyan >= 0 && minCyan <= maxCyan);
  assert(maxCyan >= minCyan && maxCyan <= 100);
  assert(minMagenta >= 0 && minMagenta <= maxMagenta);
  assert(maxMagenta >= minMagenta && maxMagenta <= 100);
  assert(minYellow >= 0 && minYellow <= maxYellow);
  assert(maxYellow >= minYellow && maxYellow <= 100);
  assert(minBlack >= 0 && minBlack <= maxBlack);
  assert(maxBlack >= minBlack && maxBlack <= 100);
  return cm.CmykColor.random(
    minCyan: minCyan,
    maxCyan: maxCyan,
    minMagenta: minMagenta,
    maxMagenta: maxMagenta,
    minYellow: minYellow,
    maxYellow: maxYellow,
    minBlack: minBlack,
    maxBlack: maxBlack,
    seed: seed,
  ).cast();
}