If you got to this page looking for a simple HSL-RGB converter that returns BYTE components as used by Windows, you may prefer to use the HSL-RGB Converter.
gColor is designed for fast, accurate colour manipulation.
Each colour component (R,G,B,A) is held as a double in the interval [0,1].
Each component can be set or retrieved as float or double with this interval as well as BYTE or int in the interval [0,255].
Constructors exist to create a colour from the components, as well as from the Hue (pick a colour from the spectrum in the interval [0,1]), a 'NoColor' (useful when a system has a 'default colour'), or a random colour.
Saturation can be set using Perceived Luminance in its calculation (see image).
Brightness is adjustable and some static methods provide Gamma Correction, Exposure and Light Power methods.
The RGBA components can be set or retrieved as HSL or HSV components.
A Colour Spline (for implementing a Colour Bar for gradient fills etc.) can be interpolated:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.