setHSL method
Implementation
Color setHSL(double h, double s, double l, [String colorSpace = LinearSRGBColorSpace]) {
// h,s,l ranges are in 0.0 - 1.0
h = MathUtils.euclideanModulo(h, 1).toDouble();
s = MathUtils.clamp(s, 0, 1);
l = MathUtils.clamp(l, 0, 1);
if (s == 0) {
r = g = b = l;
} else {
var p = l <= 0.5 ? l * (1 + s) : l + s - (l * s);
var q = (2 * l) - p;
r = hue2rgb(q, p, h + 1 / 3);
g = hue2rgb(q, p, h);
b = hue2rgb(q, p, h - 1 / 3);
}
ColorManagement.toWorkingColorSpace( this, colorSpace );
return this;
}