def format_string(self, text, color, normalize=True): """ Returns a color formatted string. @param self: Internal Colors object. @type self: Colors @param text: The text to print. @type text: str @param color: String representation of color. @type color: str @param normalize: If the string should end in normal color. @type normalize: bool @return: Color formatted string. @rtype: str """ if not self.does_color_exist(color): log_warn("Color %s doesn't exist, using default.", color) color = 'normal' end_str = "" if normalize: end_str = self.colors['normal'] return "%s%s%s" % (self.colors[color], text, end_str)
def format_string(self, text, color, normalize=True): """ Returns a color formatted string. """ if not self.does_color_exist(color): log_warn("Color %s doesn't exist, using default.", color) color = 'normal' end_str = "" if normalize: end_str = "</tt></font>" return "<font color='%s'><tt>%s%s" % \ (self.colors[color], text, end_str)