Changeset - e7d9d543364d
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-09-09 20:04:23
marcin@python-works.com
removed colorsys import
1 file changed with 17 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -211,7 +211,22 @@ def pygmentize_annotation(repo_name, fil
 

	
 
        :returns: RGB tuple
 
        """
 
        import colorsys
 

	
 
        def hsv_to_rgb(h, s, v):
 
            if s == 0.0: return v, v, v
 
            i = int(h * 6.0) # XXX assume int() truncates!
 
            f = (h * 6.0) - i
 
            p = v * (1.0 - s)
 
            q = v * (1.0 - s * f)
 
            t = v * (1.0 - s * (1.0 - f))
 
            i = i % 6
 
            if i == 0: return v, t, p
 
            if i == 1: return q, v, p
 
            if i == 2: return p, v, t
 
            if i == 3: return p, q, v
 
            if i == 4: return t, p, v
 
            if i == 5: return v, p, q
 

	
 
        golden_ratio = 0.618033988749895
 
        h = 0.22717784590367374
 

	
 
@@ -219,7 +234,7 @@ def pygmentize_annotation(repo_name, fil
 
            h += golden_ratio
 
            h %= 1
 
            HSV_tuple = [h, 0.95, 0.95]
 
            RGB_tuple = colorsys.hsv_to_rgb(*HSV_tuple)
 
            RGB_tuple = hsv_to_rgb(*HSV_tuple)
 
            yield map(lambda x:str(int(x * 256)), RGB_tuple)
 

	
 
    cgenerator = gen_color()
0 comments (0 inline, 0 general)