PyNGL Home > Functions > Color routines


Converts from the RGB color space to HSV.


h, s, v = Ngl.rgbhsv(r, g, b)


r, g, b

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

Return values


Represents the hue of the input point in HSV color space. A value of (R,0.,0.) in the input space will result in a hue of 0. in the output space.


The saturation value of the input point in HSV color space, in the range [0.,1.]. 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 V). Saturation values of 1. are fully saturated colors. The hue is technically undefined when S=0.; the code leaves H at its previous value when S=0. (0. initially). The fully saturated pure hues occur when S=1. and V=1.


The value in HSV space, in the range [0.,1.].


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

See Also

Ngl.hlsrgb, Ngl.hsvrgb, Ngl.rgbhls, Ngl.rgbyiq, Ngl.yiqrgb


For an example, see the test in