MCPcopy Create free account
hub / github.com/zxlie/FeHelper / hue2rgb

Function hue2rgb

apps/trans-color/index.js:363–370  ·  view source on GitHub ↗
(p, q, t)

Source from the content-addressed store, hash-verified

361 r = g = b = l; // achromatic
362 } else {
363 const hue2rgb = (p, q, t) => {
364 if (t < 0) t += 1;
365 if (t > 1) t -= 1;
366 if (t < 1/6) return p + (q - p) * 6 * t;
367 if (t < 1/2) return q;
368 if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
369 return p;
370 };
371 const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
372 const p = 2 * l - q;
373 r = hue2rgb(p, q, h + 1/3);

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected