const hsl2rgb = (H, S, L) => { const C = (1 - Math.abs(2*L - 1)) * S; const X = C * (1 - Math.abs(((H / 60) % 2)-1)); const m = L - C/2; const [r1, g1, b1] = H >= 0 && H < 60 ? [C, X, 0] : H >= 60 && H < 120 ? [X, C, 0] : H >= 120 && H < 180 ? [0, C, X] : H >= 180 && H < 240 ? [0, X, C] : H >= 240 && H < 300 ? [X, 0, C] : [C, 0, X]; return [(r1 + m) * 255, (g1 + m) * 255, (b1 + m) * 255]; };
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter