Bump version to 0.9.1.
[python/dscho.git] / Doc / lib / libcolorsys.tex
blobbf317a909b0c5d81272cb4e3cff08a115b4cf3be
1 \section{\module{colorsys} ---
2 Conversions between color systems}
4 \declaremodule{standard}{colorsys}
5 \modulesynopsis{Conversion functions between RGB and other color systems.}
6 \sectionauthor{David Ascher}{da@python.net}
8 The \module{colorsys} module defines bidirectional conversions of
9 color values between colors expressed in the RGB (Red Green Blue)
10 color space used in computer monitors and three other coordinate
11 systems: YIQ, HLS (Hue Lightness Saturation) and HSV (Hue Saturation
12 Value). Coordinates in all of these color spaces are floating point
13 values. In the YIQ space, the Y coordinate is between 0 and 1, but
14 the I and Q coordinates can be positive or negative. In all other
15 spaces, the coordinates are all between 0 and 1.
17 More information about color spaces can be found at
18 \url{http://www.inforamp.net/\%7epoynton/ColorFAQ.html}.
20 The \module{colorsys} module defines the following functions:
22 \begin{funcdesc}{rgb_to_yiq}{r, g, b}
23 Convert the color from RGB coordinates to YIQ coordinates.
24 \end{funcdesc}
26 \begin{funcdesc}{yiq_to_rgb}{y, i, q}
27 Convert the color from YIQ coordinates to RGB coordinates.
28 \end{funcdesc}
30 \begin{funcdesc}{rgb_to_hls}{r, g, b}
31 Convert the color from RGB coordinates to HLS coordinates.
32 \end{funcdesc}
34 \begin{funcdesc}{hls_to_rgb}{h, l, s}
35 Convert the color from HLS coordinates to RGB coordinates.
36 \end{funcdesc}
38 \begin{funcdesc}{rgb_to_hsv}{r, g, b}
39 Convert the color from RGB coordinates to HSV coordinates.
40 \end{funcdesc}
42 \begin{funcdesc}{hsv_to_rgb}{h, s, v}
43 Convert the color from HSV coordinates to RGB coordinates.
44 \end{funcdesc}
46 Example:
48 \begin{verbatim}
49 >>> import colorsys
50 >>> colorsys.rgb_to_hsv(.3, .4, .2)
51 (0.25, 0.5, 0.4)
52 >>> colorsys.hsv_to_rgb(0.25, 0.5, 0.4)
53 (0.3, 0.4, 0.2)
54 \end{verbatim}