hslToRgb1Scale method Null safety

List<double> hslToRgb1Scale(
  1. num hue,
  2. num sat,
  3. num light
)

Implementation

static List<double> hslToRgb1Scale(num hue, num sat, num light) {
  hue = hue % 360;

  if (hue < 0) {
    hue += 360;
  }

  sat /= 100;
  light /= 100;

  double f(num n) {
    num k = (n + hue / 30) % 12;
    num a = sat * min(light, 1 - light);
    return (light - a * max(-1, min(k - 3.0, min(9.0 - k, 1.0))));
  }

  return [f(0), f(8), f(4)];
}