toHSL method
Converts this colour to its HSLColour representation.
Implementation
@override
HSLColour toHSL() {
double s = 0.0;
double l = 0.0;
l = (2 - saturation) * value / 2;
if (l != 0) {
if (l == 1) {
s = 0.0;
} else if (l < 0.5) {
s = saturation * value / (l * 2);
} else {
s = saturation * value / (2 - l * 2);
}
}
return HSLColour.fromAHSL(alpha, hue, s.clamp(0.0, 1.0), l.clamp(0.0, 1.0));
}