toHslColor method

  1. @override
HslColor toHslColor()
override

Implementation

@override
HslColor toHslColor() {
  num hsvSaturation = s / 100;
  num value = v / 100;

  var lightness = value * (1 - hsvSaturation / 2);
  var saturation = lightness == 0 || lightness == 1 ? 0 : (value - lightness) / min(lightness, 1 - lightness);

  return HslColor(h, saturation * 100, lightness * 100);
}