UNPKG

@thi.ng/color

Version:

Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets

12 lines (11 loc) 248 B
import { EPS } from "@thi.ng/math/api"; import { rgbHcv } from "./rgb-hcv.js"; const rgbHsl = (out, src) => { out = rgbHcv(out, src); out[2] -= out[1] * 0.5; out[1] /= 1 + EPS - Math.abs(out[2] * 2 - 1); return out; }; export { rgbHsl };