hslToHsv function
Convert HSL to HSV
Reference: https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV
Implementation
HSVColor hslToHsv(HSLColor color) {
double s = 0.0;
double v = 0.0;
v = color.lightness + color.saturation * (color.lightness < 0.5 ? color.lightness : 1 - color.lightness);
if (v != 0) s = 2 - 2 * color.lightness / v;
return HSVColor.fromAHSV(
color.alpha,
color.hue,
s.clamp(0.0, 1.0),
v.clamp(0.0, 1.0),
);
}