Colour Functions

by Mobius Evalon
Convert between CMYK, hexadecimal, HSL, HSV and RGB.
ID:111609
 
What started as my desire to retrieve the luminosity value of an RGB triplet spawned this library -- the "modernized" version of the Hex/RGB Converter.

The Colour Functions Library (shortened to CF in many cases) is a quick and accurate tool to convert between five common colour schemas:

CMYK (cyan/magenta/yellow/key) - Used by the printing industry
Hexadecimal - Used by browsers for websafe colours
HSL (hue/saturation/luminosity) - Used by common drawing programs such as MSPaint and Dream Maker's icon editor
HSV (hue/saturation/value) - Used by photomanipulation programs such as Paint.NET and Photoshop
RGB (red/green/blue) - Common drawing program interfaces

One example of a trial run, converting between all five formats:

"255,128,64" as HSL is "13,240,150".
"13,240,150" as CMYK is "0,0.505882,0.74902,0".
"0,0.505882,0.74902,0" as HSV is "19,75,100".
"19,75,100" as Hex is "#ff7c40".
"#ff7c40" as RGB is "255,124,64".
The reference could stand to be separated from the code, but this came in handy. =)