annotate weblogolib/color.py @ 4:4d47ab2b7bcc

Uploaded
author davidmurphy
date Fri, 13 Jan 2012 07:18:19 -0500
parents c55bdc2fb9fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
3 # Copyright (c) 2005 Gavin E. Crooks
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
4 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
5 # This software is distributed under the MIT Open Source License.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
6 # <http://www.opensource.org/licenses/mit-license.html>
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
7 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
8 # Permission is hereby granted, free of charge, to any person obtaining a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
9 # copy of this software and associated documentation files (the "Software"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
10 # to deal in the Software without restriction, including without limitation
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
11 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
12 # and/or sell copies of the Software, and to permit persons to whom the
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
13 # Software is furnished to do so, subject to the following conditions:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
14 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
15 # The above copyright notice and this permission notice shall be included
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
16 # in all copies or substantial portions of the Software.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
17 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
21 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
23 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
24 # THE SOFTWARE.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
25
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
26 """ Color specifications using CSS2 (Cascading Style Sheet) syntax."""
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
27
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
28 class Color:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
29 """ Color specifications using CSS2 (Cascading Style Sheet) syntax.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
30
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
31 http://www.w3.org/TR/REC-CSS2/syndata.html#color-units
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
32
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
33 Usage:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
34
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
35 red = Color(255,0,0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
36 red = Color(1., 0., 0.)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
37 red = Color.by_name("red")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
38 red = Color.from_rgb(1.,0.,0.)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
39 red = Color.from_rgb(255,0,0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
40 red = Color.from_hsl(0.,1., 0.5)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
41
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
42 red = Color.from_string("red")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
43 red = Color.from_string("RED")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
44 red = Color.from_string("#F00")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
45 red = Color.from_string("#FF0000")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
46 red = Color.from_string("rgb(255, 0, 0)")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
47 red = Color.from_string("rgb(100%, 0%, 0%)")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
48 red = Color.from_string("hsl(0, 100%, 50%)")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
49
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
50 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
51 def __init__(self, red, green, blue) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
52
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
53 if ( type(red) is not type(green) ) or (type(red) is not type(blue)):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
54 raise TypeError("Mixed floats and integers?")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
55
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
56 if type(red) is type(1) : red = float(red)/255.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
57 if type(green) is type(1) : green = float(green)/255.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
58 if type(blue) is type(1) : blue = float(blue)/255.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
59
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
60 self.red = max(0., min(float(red), 1.0))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
61 self.green = max(0., min(float(green), 1.0))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
62 self.blue = max(0., min(float(blue), 1.0))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
63
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
64 #@staticmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
65 def names():
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
66 "Return a list of standard color names."
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
67 return _std_colors.keys()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
68 names = staticmethod(names)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
69
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
70 #@classmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
71 def from_rgb(cls, r, g, b):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
72 return cls(r,g,b)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
73 from_rgb = classmethod(from_rgb)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
74
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
75 #@classmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
76 def from_hsl(cls, hue_angle, saturation, lightness ):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
77 def hue_to_rgb( v1, v2, vH) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
78 if vH < 0.0 : vH += 1.0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
79 if vH > 1.0 : vH -= 1.0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
80 if vH*6.0 < 1.0 : return (v1 + (v2 - v1) * 6.0 * vH)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
81 if vH*2.0 < 1.0 : return v2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
82 if vH*3.0 < 2.0 : return (v1 + (v2 - v1) * ((2.0/3.0) - vH) * 6.0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
83 return v1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
84
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
85 hue = (((hue_angle % 360.) + 360.) % 360.)/360.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
86
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
87 if not (saturation >= 0.0 and saturation <=1.0) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
88 raise ValueError("Out-of-range saturation %f"% saturation)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
89 if not (lightness >= 0.0 and lightness <=1.0) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
90 raise ValueError("Out-of-range lightness %f"% lightness)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
91
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
92 if saturation == 0 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
93 # greyscale
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
94 return cls.from_rgb( lightness, lightness, lightness)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
95
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
96 if lightness < 0.5 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
97 v2 = lightness * (1.0+ saturation)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
98 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
99 v2 = (lightness + saturation) - (saturation* lightness)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
100
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
101 v1 = 2.0 * lightness - v2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
102 r = hue_to_rgb( v1, v2, hue + (1./3.) )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
103 g = hue_to_rgb( v1, v2, hue )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
104 b = hue_to_rgb( v1, v2, hue - (1./3.) )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
105
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
106 return cls(r,g,b)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
107 from_hsl = classmethod(from_hsl)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
108
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
109
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
110 #@staticmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
111 def by_name(string):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
112 s = string.strip().lower().replace(' ', '')
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
113
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
114 try:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
115 return _std_colors[s]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
116 except KeyError:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
117 raise ValueError("Unknown color name: %s"% s)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
118 by_name = staticmethod(by_name)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
119
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
120 #@classmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
121 def from_string(cls, string):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
122 def to_frac(string) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
123 # string can be "255" or "100%"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
124 if string[-1]=='%':
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
125 return float(string[0:-1])/100.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
126 else:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
127 return float(string)/255.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
128
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
129 s = string.strip().lower().replace(' ', '').replace('_', '')
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
130
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
131 if s in _std_colors : # "red"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
132 return _std_colors[s]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
133
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
134 if s[0] == "#" : # "#fef"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
135 if len(s) == 4 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
136 r = int(s[1]+s[1],16)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
137 g = int(s[2]+s[2],16)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
138 b = int(s[3]+s[3],16)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
139 return cls(r,g,b)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
140 elif len(s) ==7 : # "#ff00aa"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
141 r = int(s[1:3],16)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
142 g = int(s[3:5],16)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
143 b = int(s[5:7],16)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
144 return cls(r,g,b)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
145 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
146 raise ValueError("Cannot parse string: %s" % s)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
147
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
148 if s[0:4] == 'rgb(' and s[-1] == ')' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
149 rgb = s[4:-1].split(",")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
150 if len(rgb) != 3 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
151 raise ValueError("Cannot parse string a: %s" % s)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
152 return cls( to_frac(rgb[0]), to_frac(rgb[1]), to_frac(rgb[2]))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
153
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
154 if s[0:4] == 'hsl(' and s[-1] == ')' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
155 hsl = s[4:-1].split(",")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
156 if len(hsl) != 3 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
157 raise ValueError("Cannot parse string a: %s" % s)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
158 return cls.from_hsl( int(hsl[0]), to_frac(hsl[1]), to_frac(hsl[2]))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
159
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
160 raise ValueError("Cannot parse string: %s" % s)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
161 from_string = classmethod(from_string)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
162
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
163 def __eq__(self, other) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
164 req = int(0.5+255.*self.red) == int(0.5+255.*other.red)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
165 beq = int(0.5+255.*self.blue) == int(0.5+255.*other.blue)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
166 geq = int(0.5+255.*self.green) == int(0.5+255.*other.green)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
167
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
168 return req and beq and geq
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
169
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
170 def __repr__(self):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
171 return "Color(%f,%f,%f)" % (self.red, self.green, self.blue)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
172
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
173
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
174 _std_colors = dict(
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
175 aliceblue = Color(240,248,255), #f0f8ff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
176 antiquewhite = Color(250,235,215), #faebd7
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
177 aqua = Color(0,255,255), #00ffff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
178 aquamarine = Color(127,255,212), #7fffd4
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
179 azure = Color(240,255,255), #f0ffff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
180 beige = Color(245,245,220), #f5f5dc
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
181 bisque = Color(255,228,196), #ffe4c4
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
182 black = Color(0,0,0), #000000
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
183 blanchedalmond = Color(255,235,205), #ffebcd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
184 blue = Color(0,0,255), #0000ff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
185 blueviolet = Color(138,43,226), #8a2be2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
186 brown = Color(165,42,42), #a52a2a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
187 burlywood = Color(222,184,135), #deb887
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
188 cadetblue = Color(95,158,160), #5f9ea0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
189 chartreuse = Color(127,255,0), #7fff00
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
190 chocolate = Color(210,105,30), #d2691e
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
191 coral = Color(255,127,80), #ff7f50
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
192 cornflowerblue = Color(100,149,237), #6495ed
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
193 cornsilk = Color(255,248,220), #fff8dc
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
194 crimson = Color(220,20,60), #dc143c
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
195 cyan = Color(0,255,255), #00ffff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
196 darkblue = Color(0,0,139), #00008b
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
197 darkcyan = Color(0,139,139), #008b8b
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
198 darkgoldenrod = Color(184,134,11), #b8860b
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
199 darkgray = Color(169,169,169), #a9a9a9
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
200 darkgreen = Color(0,100,0), #006400
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
201 darkgrey = Color(169,169,169), #a9a9a9
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
202 darkkhaki = Color(189,183,107), #bdb76b
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
203 darkmagenta = Color(139,0,139), #8b008b
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
204 darkolivegreen = Color(85,107,47), #556b2f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
205 darkorange = Color(255,140,0), #ff8c00
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
206 darkorchid = Color(153,50,204), #9932cc
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
207 darkred = Color(139,0,0), #8b0000
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
208 darksalmon = Color(233,150,122), #e9967a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
209 darkseagreen = Color(143,188,143), #8fbc8f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
210 darkslateblue = Color(72,61,139), #483d8b
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
211 darkslategray = Color(47,79,79), #2f4f4f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
212 darkslategrey = Color(47,79,79), #2f4f4f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
213 darkturquoise = Color(0,206,209), #00ced1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
214 darkviolet = Color(148,0,211), #9400d3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
215 deeppink = Color(255,20,147), #ff1493
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
216 deepskyblue = Color(0,191,255), #00bfff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
217 dimgray = Color(105,105,105), #696969
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
218 dimgrey = Color(105,105,105), #696969
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
219 dodgerblue = Color(30,144,255), #1e90ff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
220 firebrick = Color(178,34,34), #b22222
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
221 floralwhite = Color(255,250,240), #fffaf0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
222 forestgreen = Color(34,139,34), #228b22
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
223 fuchsia = Color(255,0,255), #ff00ff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
224 gainsboro = Color(220,220,220), #dcdcdc
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
225 ghostwhite = Color(248,248,255), #f8f8ff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
226 gold = Color(255,215,0), #ffd700
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
227 goldenrod = Color(218,165,32), #daa520
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
228 gray = Color(128,128,128), #808080
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
229 green = Color(0,128,0), #008000
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
230 greenyellow = Color(173,255,47), #adff2f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
231 grey = Color(128,128,128), #808080
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
232 honeydew = Color(240,255,240), #f0fff0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
233 hotpink = Color(255,105,180), #ff69b4
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
234 indianred = Color(205,92,92), #cd5c5c
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
235 indigo = Color(75,0,130), #4b0082
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
236 ivory = Color(255,255,240), #fffff0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
237 khaki = Color(240,230,140), #f0e68c
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
238 lavender = Color(230,230,250), #e6e6fa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
239 lavenderblush = Color(255,240,245), #fff0f5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
240 lawngreen = Color(124,252,0), #7cfc00
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
241 lemonchiffon = Color(255,250,205), #fffacd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
242 lightblue = Color(173,216,230), #add8e6
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
243 lightcoral = Color(240,128,128), #f08080
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
244 lightcyan = Color(224,255,255), #e0ffff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
245 lightgoldenrodyellow = Color(250,250,210), #fafad2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
246 lightgray = Color(211,211,211), #d3d3d3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
247 lightgreen = Color(144,238,144), #90ee90
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
248 lightgrey = Color(211,211,211), #d3d3d3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
249 lightpink = Color(255,182,193), #ffb6c1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
250 lightsalmon = Color(255,160,122), #ffa07a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
251 lightseagreen = Color(32,178,170), #20b2aa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
252 lightskyblue = Color(135,206,250), #87cefa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
253 lightslategray = Color(119,136,153), #778899
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
254 lightslategrey = Color(119,136,153), #778899
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
255 lightsteelblue = Color(176,196,222), #b0c4de
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
256 lightyellow = Color(255,255,224), #ffffe0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
257 lime = Color(0,255,0), #00ff00
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
258 limegreen = Color(50,205,50), #32cd32
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
259 linen = Color(250,240,230), #faf0e6
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
260 magenta = Color(255,0,255), #ff00ff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
261 maroon = Color(128,0,0), #800000
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
262 mediumaquamarine = Color(102,205,170), #66cdaa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
263 mediumblue = Color(0,0,205), #0000cd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
264 mediumorchid = Color(186,85,211), #ba55d3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
265 mediumpurple = Color(147,112,219), #9370db
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
266 mediumseagreen = Color(60,179,113), #3cb371
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
267 mediumslateblue = Color(123,104,238), #7b68ee
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
268 mediumspringgreen = Color(0,250,154), #00fa9a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
269 mediumturquoise = Color(72,209,204), #48d1cc
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
270 mediumvioletred = Color(199,21,133), #c71585
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
271 midnightblue = Color(25,25,112), #191970
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
272 mintcream = Color(245,255,250), #f5fffa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
273 mistyrose = Color(255,228,225), #ffe4e1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
274 moccasin = Color(255,228,181), #ffe4b5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
275 navajowhite = Color(255,222,173), #ffdead
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
276 navy = Color(0,0,128), #000080
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
277 oldlace = Color(253,245,230), #fdf5e6
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
278 olive = Color(128,128,0), #808000
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
279 olivedrab = Color(107,142,35), #6b8e23
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
280 orange = Color(255,165,0), #ffa500
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
281 orangered = Color(255,69,0), #ff4500
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
282 orchid = Color(218,112,214), #da70d6
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
283 palegoldenrod = Color(238,232,170), #eee8aa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
284 palegreen = Color(152,251,152), #98fb98
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
285 paleturquoise = Color(175,238,238), #afeeee
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
286 palevioletred = Color(219,112,147), #db7093
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
287 papayawhip = Color(255,239,213), #ffefd5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
288 peachpuff = Color(255,218,185), #ffdab9
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
289 peru = Color(205,133,63), #cd853f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
290 pink = Color(255,192,203), #ffc0cb
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
291 plum = Color(221,160,221), #dda0dd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
292 powderblue = Color(176,224,230), #b0e0e6
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
293 purple = Color(128,0,128), #800080
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
294 red = Color(255,0,0), #ff0000
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
295 rosybrown = Color(188,143,143), #bc8f8f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
296 royalblue = Color(65,105,225), #4169e1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
297 saddlebrown = Color(139,69,19), #8b4513
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
298 salmon = Color(250,128,114), #fa8072
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
299 sandybrown = Color(244,164,96), #f4a460
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
300 seagreen = Color(46,139,87), #2e8b57
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
301 seashell = Color(255,245,238), #fff5ee
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
302 sienna = Color(160,82,45), #a0522d
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
303 silver = Color(192,192,192), #c0c0c0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
304 skyblue = Color(135,206,235), #87ceeb
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
305 slateblue = Color(106,90,205), #6a5acd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
306 slategray = Color(112,128,144), #708090
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
307 slategrey = Color(112,128,144), #708090
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
308 snow = Color(255,250,250), #fffafa
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
309 springgreen = Color(0,255,127), #00ff7f
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
310 steelblue = Color(70,130,180), #4682b4
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
311 tan = Color(210,180,140), #d2b48c
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
312 teal = Color(0,128,128), #008080
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
313 thistle = Color(216,191,216), #d8bfd8
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
314 tomato = Color(255,99,71), #ff6347
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
315 turquoise = Color(64,224,208), #40e0d0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
316 violet = Color(238,130,238), #ee82ee
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
317 wheat = Color(245,222,179), #f5deb3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
318 white = Color(255,255,255), #ffffff
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
319 whitesmoke = Color(245,245,245), #f5f5f5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
320 yellow = Color(255,255,0), #ffff00
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
321 yellowgreen = Color(154,205,50) #9acd32
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
322 )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
323
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
324