(p, q, t)
| 205 | const s = Math.max(0, Math.min(1, S)); |
| 206 | const l = Math.max(0, Math.min(1, L)); |
| 207 | const hue2rgb = (p, q, t) => { |
| 208 | if (t < 0) t += 1; |
| 209 | if (t > 1) t -= 1; |
| 210 | if (t < 1 / 6) return p + (q - p) * 6 * t; |
| 211 | if (t < 1 / 2) return q; |
| 212 | if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; |
| 213 | return p; |
| 214 | }; |
| 215 | const q = l < 0.5 ? l * (1 + s) : l + s - l * s; |
| 216 | const p = 2 * l - q; |
| 217 | return { |