diff options
author | Fred Drake <fdrake@acm.org> | 1999-04-19 21:20:13 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-04-19 21:20:13 (GMT) |
commit | 32c562bdec55134539408c122ecc89a382b4fe97 (patch) | |
tree | bdfefd0d69bed815a582ef4b0b753eec65994d05 | |
parent | 9d158817446c06ed0e0d8e00d7e2345c836f72e1 (diff) | |
download | cpython-32c562bdec55134539408c122ecc89a382b4fe97.zip cpython-32c562bdec55134539408c122ecc89a382b4fe97.tar.gz cpython-32c562bdec55134539408c122ecc89a382b4fe97.tar.bz2 |
colorsys docs from David Ascher.
-rw-r--r-- | Doc/lib/libcolorsys.tex | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Doc/lib/libcolorsys.tex b/Doc/lib/libcolorsys.tex new file mode 100644 index 0000000..bf317a9 --- /dev/null +++ b/Doc/lib/libcolorsys.tex @@ -0,0 +1,54 @@ +\section{\module{colorsys} --- + Conversions between color systems} + +\declaremodule{standard}{colorsys} +\modulesynopsis{Conversion functions between RGB and other color systems.} +\sectionauthor{David Ascher}{da@python.net} + +The \module{colorsys} module defines bidirectional conversions of +color values between colors expressed in the RGB (Red Green Blue) +color space used in computer monitors and three other coordinate +systems: YIQ, HLS (Hue Lightness Saturation) and HSV (Hue Saturation +Value). Coordinates in all of these color spaces are floating point +values. In the YIQ space, the Y coordinate is between 0 and 1, but +the I and Q coordinates can be positive or negative. In all other +spaces, the coordinates are all between 0 and 1. + +More information about color spaces can be found at +\url{http://www.inforamp.net/\%7epoynton/ColorFAQ.html}. + +The \module{colorsys} module defines the following functions: + +\begin{funcdesc}{rgb_to_yiq}{r, g, b} +Convert the color from RGB coordinates to YIQ coordinates. +\end{funcdesc} + +\begin{funcdesc}{yiq_to_rgb}{y, i, q} +Convert the color from YIQ coordinates to RGB coordinates. +\end{funcdesc} + +\begin{funcdesc}{rgb_to_hls}{r, g, b} +Convert the color from RGB coordinates to HLS coordinates. +\end{funcdesc} + +\begin{funcdesc}{hls_to_rgb}{h, l, s} +Convert the color from HLS coordinates to RGB coordinates. +\end{funcdesc} + +\begin{funcdesc}{rgb_to_hsv}{r, g, b} +Convert the color from RGB coordinates to HSV coordinates. +\end{funcdesc} + +\begin{funcdesc}{hsv_to_rgb}{h, s, v} +Convert the color from HSV coordinates to RGB coordinates. +\end{funcdesc} + +Example: + +\begin{verbatim} +>>> import colorsys +>>> colorsys.rgb_to_hsv(.3, .4, .2) +(0.25, 0.5, 0.4) +>>> colorsys.hsv_to_rgb(0.25, 0.5, 0.4) +(0.3, 0.4, 0.2) +\end{verbatim} |