color-tf
Version:
RGB, HSL, HSV, HWB and more color models convertors
28 lines (24 loc) • 465 B
JavaScript
;
var hsv2rgb = (h, s, v) => {
const i = Math.floor(h * 6);
const f = h * 6 - i;
const p = v * (1 - s);
const q = v * (1 - f * s);
const t = v * (1 - (1 - f) * s);
switch (i) {
case 6:
case 0:
return [v, t, p];
case 1:
return [q, v, p];
case 2:
return [p, v, t];
case 3:
return [p, q, v];
case 4:
return [t, p, v];
case 5:
return [v, p, q];
}
};
module.exports = hsv2rgb;