Home | Trees | Indices | Help |
---|
|
1 # Copyright (c) 2010 Arjan Scherpenisse 2 # See LICENSE for details. 3 4 """ 5 Utility functions for graphics. 6 """ 79 """ 10 Given a string in hexadecimal RGB notation, return a (r,g,b) triplet where r,g,b in 0.0 >= x > 1.0 11 """ 12 if len(x) not in [3,4,6,7]: 13 return False 14 if x[0] == "#": 15 x = x[1:] 16 if len(x) == 3: 17 x = x[0]+x[0]+x[1]+x[1]+x[2]+x[2] 18 19 col = [] 20 for i in range(3): 21 col.append(int(x[i*2:i*2+2], 16)/255.) 22 return tuple(col)23
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Sep 30 15:21:52 2010 | http://epydoc.sourceforge.net |