MCPcopy Index your code
hub / github.com/figma/plugin-samples / hue2rgb

Function hue2rgb

variables-import-export/code.js:258–265  ·  view source on GitHub ↗
(p, q, t)

Source from the content-addressed store, hash-verified

256
257function hslToRgbFloat(h, s, l) {
258 const hue2rgb = (p, q, t) => {
259 if (t < 0) t += 1;
260 if (t > 1) t -= 1;
261 if (t < 1 / 6) return p + (q - p) * 6 * t;
262 if (t < 1 / 2) return q;
263 if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
264 return p;
265 };
266
267 if (s === 0) {
268 return { r: l, g: l, b: l };

Callers 1

hslToRgbFloatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected