##// END OF EJS Templates
removed colorsys import
marcink -
r1461:e7d9d543 beta
parent child Browse files
Show More
@@ -211,7 +211,22 b' def pygmentize_annotation(repo_name, fil'
211
211
212 :returns: RGB tuple
212 :returns: RGB tuple
213 """
213 """
214 import colorsys
214
215 def hsv_to_rgb(h, s, v):
216 if s == 0.0: return v, v, v
217 i = int(h * 6.0) # XXX assume int() truncates!
218 f = (h * 6.0) - i
219 p = v * (1.0 - s)
220 q = v * (1.0 - s * f)
221 t = v * (1.0 - s * (1.0 - f))
222 i = i % 6
223 if i == 0: return v, t, p
224 if i == 1: return q, v, p
225 if i == 2: return p, v, t
226 if i == 3: return p, q, v
227 if i == 4: return t, p, v
228 if i == 5: return v, p, q
229
215 golden_ratio = 0.618033988749895
230 golden_ratio = 0.618033988749895
216 h = 0.22717784590367374
231 h = 0.22717784590367374
217
232
@@ -219,7 +234,7 b' def pygmentize_annotation(repo_name, fil'
219 h += golden_ratio
234 h += golden_ratio
220 h %= 1
235 h %= 1
221 HSV_tuple = [h, 0.95, 0.95]
236 HSV_tuple = [h, 0.95, 0.95]
222 RGB_tuple = colorsys.hsv_to_rgb(*HSV_tuple)
237 RGB_tuple = hsv_to_rgb(*HSV_tuple)
223 yield map(lambda x:str(int(x * 256)), RGB_tuple)
238 yield map(lambda x:str(int(x * 256)), RGB_tuple)
224
239
225 cgenerator = gen_color()
240 cgenerator = gen_color()
General Comments 0
You need to be logged in to leave comments. Login now