UNPKG

@thi.ng/color

Version:

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

8 lines (7 loc) 200 B
import { fract } from "@thi.ng/math/prec"; const closestHue = (h) => Math.round(fract(h) * 12) % 12; const closestPrimaryHue = (h) => closestHue(h) & 14; export { closestHue, closestPrimaryHue };