99__maintainer__ = "Harsha Rani"
10101111__status__ = "Development"
12- __updated__ = "Jan 29 2019"
12+ __updated__ = "Mar 11 2019"
1313
1414import moose
1515import numpy as np
@@ -47,13 +47,13 @@ def getColor(iteminfo):
4747 """
4848 textcolor = moose .element (iteminfo ).textColor
4949 bgcolor = moose .element (iteminfo ).color
50-
5150 if (textcolor == '' ): textcolor = 'green'
5251
5352 if (bgcolor == '' ): bgcolor = 'orange'
5453
5554 if (textcolor == bgcolor ):
5655 textcolor = getRandColor ()
56+
5757 textcolor = colorCheck (textcolor )
5858 bgcolor = colorCheck (bgcolor )
5959 # if moose.exists(iteminfo):
@@ -71,8 +71,7 @@ def colorCheck(fc_bgcolor):
7171 fc_bgcolor = fc_bgcolor
7272 elif fc_bgcolor .isdigit ():
7373 """ color is int a map from int to r,g,b triplets from pickled color map file """
74- tc = int (fc_bgcolor )
75- tc = tc * 2
74+ tc = (int (fc_bgcolor ))* 2
7675 if tc < len (colorMap ):
7776 pickledColor = colorMap [tc ]
7877 else :
@@ -83,10 +82,16 @@ def colorCheck(fc_bgcolor):
8382 fc_bgcolor = validColorcheck (fc_bgcolor )
8483
8584 else :
86- for r in ['[' ,']' ]:
85+ for r in ['[' ,']' , '(' , ')' ]:
8786 fc_bgcolor = fc_bgcolor .replace (r ,"" )
88- fc_bgcolor = '#%02x%02x%02x' % (eval (fc_bgcolor ))
89-
87+ fc_bgcolor = fc_bgcolor .split ("," )
88+ c = 0
89+ hexlist = "#"
90+ for n in fc_bgcolor :
91+ if c < 3 :
92+ hexlist = hexlist + str ("%02x" % int (n ))
93+ c = c + 1 ;
94+ fc_bgcolor = hexlist
9095 return (fc_bgcolor )
9196
9297def validColorcheck (color ):
0 commit comments