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.
26 \begin{funcdesc
}{yiq_to_rgb
}{y, i, q
}
27 Convert the
color from YIQ coordinates to RGB coordinates.
30 \begin{funcdesc
}{rgb_to_hls
}{r, g, b
}
31 Convert the
color from RGB coordinates to HLS coordinates.
34 \begin{funcdesc
}{hls_to_rgb
}{h, l, s
}
35 Convert the
color from HLS coordinates to RGB coordinates.
38 \begin{funcdesc
}{rgb_to_hsv
}{r, g, b
}
39 Convert the
color from RGB coordinates to HSV coordinates.
42 \begin{funcdesc
}{hsv_to_rgb
}{h, s, v
}
43 Convert the
color from HSV coordinates to RGB coordinates.
50 >>> colorsys.rgb_to_hsv(
.3,
.4,
.2)
52 >>> colorsys.hsv_to_rgb(
0.25,
0.5,
0.4)