views:

591

answers:

4

Hi I am looking for a tool to convert between HSL color to RGB. HSL is not a very widely used so I am not having much luck googling for a converter.

If you know of one, or an easily implementable algorithm it would be much appreciated.

+2  A: 

The article for HSL and HSV on the wikipedia contains some formulas. The calculation are a bit tricky, it might be useful to take a look at existing implementations.

Otto Allmendinger
+1  A: 

You can take a look at the Wikipedia's entry on HSL. There is a section that describes how the conversion from and to RGB can occur.

Laurent Etiemble
+1  A: 

Found the easiest way, python to the rescue :D

colorsys.hls_to_rgb(h, l, s)

Convert the color from HLS coordinates to RGB coordinates.

hhafez
A: 

Just noticed that the less.js project has a number of colour manipulation functions, including hsl_to_rgb:

http://github.com/cloudhead/less.js/blob/master/lib/less/functions.js

mitjak