-
- def color_from_name(self,name):
- n = md5.md5(name).digest()
- hf = float(ord(n[0])+ord(n[1])*0xff)/0xffff
- sf = float(ord(n[2]))/0xff
- vf = float(ord(n[3]))/0xff
- r,g,b = colorsys.hsv_to_rgb(hf, 0.3+0.6*sf, 0.8+0.2*vf)
- return '#%02x%02x%02x' % (r*256,g*256,b*256)
+
+ def color_from_name(self, name):
+ n = hashlib.md5(name).digest()
+ hf = float(ord(n[0]) + ord(n[1]) * 0xff) / 0xffff
+ sf = float(ord(n[2])) / 0xff
+ vf = float(ord(n[3])) / 0xff
+ r, g, b = colorsys.hsv_to_rgb(hf, 0.3 + 0.6 * sf, 0.8 + 0.2 * vf)
+ return '#%02x%02x%02x' % (r * 256, g * 256, b * 256)