float-rgb2hsl
Converts [R,G,B] to [H,S,L].
var rgb2hsl = var rgb = 0375 0625 0625 var hsl = // -> [0.5, 0.25, 0.5]
All input/output uses the range [0 .. 1] for consistency and composition with other modules.
Usage
hsl = rgb2hsl(rgb)
Takes the rgb
float array [R, G, B]
and returns a [H, S, L]
float representation.
Motivation
This was adapted from @harthur's wonderful color-convert module. Often I found myself only needing one function rather than all of them, and consistent input/output lends well to composition with other modules and WebGL.
License
MIT, see LICENSE.md for details.