toHSV method

HSVColor toHSV()

Implementation

HSVColor toHSV() {
  final double l = lightness;
  final double s = saturation;
  final double h = hue;
  final double a = alpha;
  final double v = l + s * min(l, 1 - l);
  double newH;
  double newS;
  if (v == 0) {
    newH = 0;
    newS = 0;
  } else {
    newS = 2 * (1 - l / v);
    newH = h;
  }
  return HSVColor.fromAHSV(a, newH, newS, v);
}