export function processHue ( p , q , t ) { if ( t < 0 ) t += 1 ; if ( t > 1 ) t -= 1 ; if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t ; if ( t < 1 / 2 ) return q ; if ( t < 2 / 3 ) return p + ( q - p ) * ( 2 / 3 - t ) * 6 ; return p ; } param h param s param l returns export function hslToRgb ( h , s , l ) { const outColor = { r : 0 , g : 0 , b : 0 } ; if ( s === 0 ) { outColor . r = outColor . g = outColor . b = l * 255 ; } else { var q = l < 0.5 ? l * ( 1 + s ) : l + s - l * s ; var p = 2 * l - q ; outColor . r = processHue ( p , q , h + 1 / 3 ) * 255 ; outColor . g = processHue ( p , q , h ) * 255 ; outColor . b = processHue ( p , q , h - 1 / 3 ) * 255 ; } return outColor ; }