Skip to content

mattdesl/float-hsl2rgb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

float-hsl2rgb

stable

Converts [H,S,L] to [R,G,B].

var hsl2rgb = require('float-hsl2rgb')

var hsl = [180/360, 0.25, 0.50]

var rgb = hsl2rgb(hsl)
// -> [0.375, 0.625, 0.625]

All input/output uses the range [0 .. 1] for consistency and composition with other modules.

Usage

NPM

rgb = hsl2rgb(hsl)

Takes the hsl float array [H, S, L] and returns an [R, G, B] 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.

About

converts [H,S,L] to [R,G,B]

Resources

License

Stars

Watchers

Forks

Packages

No packages published