in basemap/utils/color.js [148:174]
toHSL() {
let r = this.r / 255;
let g = this.g / 255;
let b = this.b / 255;
let max = Math.max(r, g, b);
let min = Math.min(r, g, b);
let h, s, l = (max + min) / 2;
if (max == min) {
h = s = 0;
} else {
let d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0)
break;
case g:
h = (b - r) / d + 2
break;
case b:
h = (r - g) / d + 4
break;
}
h /= 6;
}
return new HSL(h, s, l, this.a);
}