cmykToRgb function

List<int> cmykToRgb(
  1. num c,
  2. num m,
  3. num y,
  4. num k,
)

Convert a CMYK color to RGB, where c, m, y, k values are in the range 0, 255. Returns a list r, g, b with values in the range 0, 255.

Implementation

List<int> cmykToRgb(num c, num m, num y, num k) {
  c /= 255.0;
  m /= 255.0;
  y /= 255.0;
  k /= 255.0;
  return [
    (255.0 * (1.0 - c) * (1.0 - k)).round(),
    (255.0 * (1.0 - m) * (1.0 - k)).round(),
    (255.0 * (1.0 - y) * (1.0 - k)).round()
  ];
}