def rrggbb_to_triplet(color):
 rgbtuple = _namedict.get(color)
 if (rgbtuple is None):
  if (color[0] != '#'):
   raise BadColor(color)
  red = color[1:3]
  green = color[3:5]
  blue = color[5:7]
  rgbtuple = (int(red, 16), int(green, 16), int(blue, 16))
  _namedict[color] = rgbtuple
 return rgbtuple

def rrggbb_to_triplet ( color ) : rgbtuple = _namedict . get ( color ) if ( rgbtuple is None ) : if ( color [ 0 ] != '#' ) : raise BadColor ( color ) red = color [ 1 : 3 ] green = color [ 3 : 5 ] blue = color [ 5 : 7 ] rgbtuple = ( int ( red , 16 ) , int ( green , 16 ) , int ( blue , 16 ) ) _namedict [ color ] = rgbtuple return rgbtuple
converts a #rrggbb color to the tuple .