PyNGL Home > Functions > Color routines

Ngl.rgbhls

Converts from the RGB color space to HLS.

Prototype

h, l, s = Ngl.rgbhls(r, g, b)

Arguments

r, g, b

Intensity values for red, green, and blue in the range [0.1.].

Return values

h

The hue of the input point in HLS color space, in the range [0.,360.). A value of (0.,0.,1.) in the input space will result in a hue of 0. in the output space.

l

The lightness value of the input point in HLS color space in the range [0.,100.]. Lightness is a measure of the quantity of light - a lightness of 0. is black, and a lightness of 100. is white. The pure hues occur at lightness value 50.

s

The saturation value of the input point in HLS color space in the range [0.,100.]. Saturation is a measure of how much white light is mixed with the color. Saturation values of 0. represent grays (with a gray value equal to the lightness value L). Saturation values of 100. are fully saturated colors. The hue is undefined when S=0. The fully saturated pure hues occur when S=100. and L=50. The saturation value should be thought of as a percentage.

Description

This function converts from the RGB (Red, Green, Blue) color space to the HLS (Hue, Lightness, Saturation) color space.

See Also

Ngl.hlsrgb, Ngl.hsvrgb, Ngl.rgbhsv, Ngl.rgbyiq, Ngl.yiqrgb

Examples

For an example, see the test in color3.py.