[Python-checkins] commit of r41428 - in python/trunk: . Lib

fredrik.lundh@python.org fredrik.lundh at python.org
Sat Nov 12 16:21:05 CET 2005


Author: fredrik.lundh
Date: Sat Nov 12 16:21:05 2005
New Revision: 41428

Modified:
   python/trunk/   (props changed)
   python/trunk/Lib/colorsys.py
Log:
 r879 at spiff:  Fredrik | 2005-11-12 14:38:03 +0100
  r878 at spiff:  Fredrik | 2005-11-12 14:37:22 +0100
  minor docstring and comment tweaks (wikipedia might not be the
  ultimate reference, but it's a lot better than "XXX" ;-)
  
 


Modified: python/trunk/Lib/colorsys.py
==============================================================================
--- python/trunk/Lib/colorsys.py	(original)
+++ python/trunk/Lib/colorsys.py	Sat Nov 12 16:21:05 2005
@@ -5,17 +5,21 @@
   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].
-Inputs outside this range may cause exceptions or invalid outputs.
+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: used by composite video signals
+YIQ: Luminance, Chrominance (used by composite video signals)
 HLS: Hue, Luminance, Saturation
 HSV: Hue, Saturation, Value
 """
+
 # References:
-# XXX Where's the literature?
+# http://en.wikipedia.org/wiki/YIQ
+# http://en.wikipedia.org/wiki/HLS_color_space
+# http://en.wikipedia.org/wiki/HSV_color_space
 
 __all__ = ["rgb_to_yiq","yiq_to_rgb","rgb_to_hls","hls_to_rgb",
            "rgb_to_hsv","hsv_to_rgb"]
@@ -26,7 +30,6 @@
 ONE_SIXTH = 1.0/6.0
 TWO_THIRD = 2.0/3.0
 
-
 # YIQ: used by composite video signals (linear combinations of RGB)
 # Y: perceived grey level (0.0 == black, 1.0 == white)
 # I, Q: color components
@@ -50,10 +53,10 @@
     return (r, g, b)
 
 
-# HLS: Hue, Luminance, S???
+# HLS: Hue, Luminance, Saturation
 # H: position in the spectrum
-# L: ???
-# S: ???
+# L: color lightness
+# S: color saturation
 
 def rgb_to_hls(r, g, b):
     maxc = max(r, g, b)
@@ -87,10 +90,10 @@
     return m1
 
 
-# HSV: Hue, Saturation, Value(?)
+# HSV: Hue, Saturation, Value
 # H: position in the spectrum
-# S: ???
-# V: ???
+# S: color saturation ("purity")
+# V: color brightness
 
 def rgb_to_hsv(r, g, b):
     maxc = max(r, g, b)


More information about the Python-checkins mailing list