toHsvColor method

HsvColor toHsvColor()
override

Implementation

HsvColor toHsvColor() {
  num hslSaturation = s / 100;
  num lightness = l / 100;

  num value = lightness + hslSaturation * min(lightness, 1 - lightness);
  num saturation = value == 0 ? 0 : 2 * (1 - lightness / value);

  return HsvColor(h, saturation * 100, value * 100);
}