Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d89e35

Browse files
author
Fredrik Lundh
committed
r879@spiff: Fredrik | 2005-11-12 14:38:03 +0100
r878@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" ;-)
1 parent 3a49e92 commit 0d89e35

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

Lib/colorsys.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
rgb_to_abc(r, g, b) --> a, b, c
66
abc_to_rgb(a, b, c) --> r, g, b
77
8-
All inputs and outputs are triples of floats in the range [0.0...1.0].
9-
Inputs outside this range may cause exceptions or invalid outputs.
8+
All inputs and outputs are triples of floats in the range [0.0...1.0]
9+
(with the exception of I and Q, which covers a slightly larger range).
10+
Inputs outside the valid range may cause exceptions or invalid outputs.
1011
1112
Supported color systems:
1213
RGB: Red, Green, Blue components
13-
YIQ: used by composite video signals
14+
YIQ: Luminance, Chrominance (used by composite video signals)
1415
HLS: Hue, Luminance, Saturation
1516
HSV: Hue, Saturation, Value
1617
"""
18+
1719
# References:
18-
# XXX Where's the literature?
20+
# http://en.wikipedia.org/wiki/YIQ
21+
# http://en.wikipedia.org/wiki/HLS_color_space
22+
# http://en.wikipedia.org/wiki/HSV_color_space
1923

2024
__all__ = ["rgb_to_yiq","yiq_to_rgb","rgb_to_hls","hls_to_rgb",
2125
"rgb_to_hsv","hsv_to_rgb"]
@@ -26,7 +30,6 @@
2630
ONE_SIXTH = 1.0/6.0
2731
TWO_THIRD = 2.0/3.0
2832

29-
3033
# YIQ: used by composite video signals (linear combinations of RGB)
3134
# Y: perceived grey level (0.0 == black, 1.0 == white)
3235
# I, Q: color components
@@ -50,10 +53,10 @@ def yiq_to_rgb(y, i, q):
5053
return (r, g, b)
5154

5255

53-
# HLS: Hue, Luminance, S???
56+
# HLS: Hue, Luminance, Saturation
5457
# H: position in the spectrum
55-
# L: ???
56-
# S: ???
58+
# L: color lightness
59+
# S: color saturation
5760

5861
def rgb_to_hls(r, g, b):
5962
maxc = max(r, g, b)
@@ -87,10 +90,10 @@ def _v(m1, m2, hue):
8790
return m1
8891

8992

90-
# HSV: Hue, Saturation, Value(?)
93+
# HSV: Hue, Saturation, Value
9194
# H: position in the spectrum
92-
# S: ???
93-
# V: ???
95+
# S: color saturation ("purity")
96+
# V: color brightness
9497

9598
def rgb_to_hsv(r, g, b):
9699
maxc = max(r, g, b)

0 commit comments

Comments
 (0)