def triplet_to_rrggbb(rgbtuple):
 global _tripdict
 hexname = _tripdict.get(rgbtuple)
 if (hexname is None):
  hexname = ('#%02x%02x%02x' % rgbtuple)
  _tripdict[rgbtuple] = hexname
 return hexname

def triplet_to_rrggbb ( rgbtuple ) : global _tripdict hexname = _tripdict . get ( rgbtuple ) if ( hexname is None ) : hexname = ( '#%02x%02x%02x' % rgbtuple ) _tripdict [ rgbtuple ] = hexname return hexname
converts a tuple to #rrggbb .