#NEWLINE# def re_color( self , text ) : #NEWLINE# #INDENT# '\n        Replace ansi colors with html color class names.  Let the\n        client choose how it will display colors, if it wishes to.\n\n        Args:\n            text (str): the string with color to replace.\n\n        Returns:\n            text (str): Re-colored text.\n\n        ' #NEWLINE# for ( colorname , regex ) in self . re_fgs : #NEWLINE# #INDENT# text = regex . sub ( ( '<span class="%s">\\1</span>' % colorname ) , text ) #NEWLINE# #UNINDENT# for ( bgname , regex ) in self . re_bgs : #NEWLINE# #INDENT# text = regex . sub ( ( '<span class="%s">\\1</span>' % bgname ) , text ) #NEWLINE# #UNINDENT# return self . re_normal . sub ( '' , text )