Back to module index
Go to module by name
colorsys
Conversion functions between RGB and other color systems.
This modules provides two functions for each color system ABC:
rgb_to_abc(r, g, b) --> a, b, c
abc_to_rgb(a, b, c) --> r, g, b
All inputs and outputs are triples of floats in the range [0.0...1.0]
(with the exception of I and Q, which covers a slightly larger range).
Inputs outside the valid range may cause exceptions or invalid outputs.
Supported color systems:
RGB: Red, Green, Blue components
YIQ: Luminance, Chrominance (used by composite video signals)
HLS: Hue, Luminance, Saturation
HSV: Hue, Saturation, Value
Functions
hls_to_rgb
hls_to_rgb(h, l, s)
hsv_to_rgb
hsv_to_rgb(h, s, v)
rgb_to_hls
rgb_to_hls(r, g, b)
rgb_to_hsv
rgb_to_hsv(r, g, b)
rgb_to_yiq
rgb_to_yiq(r, g, b)
yiq_to_rgb
yiq_to_rgb(y, i, q)
Other members
ONE_SIXTH = 0.16666666666666666
ONE_THIRD = 0.3333333333333333
TWO_THIRD = 0.6666666666666666