Color-code entire string.

        :param str string: String to colorize.
        :param bool auto: Enable auto-color (dark/light terminal).

        :return: Class instance for colorized string.
        :rtype: Color
427245
def blue(cls, string, auto=False):
        
        return cls.colorize('blue', string, auto=auto)
1363212
def black(cls, string, auto=False):
        
        return cls.colorize('black', string, auto=auto)
1177457
def colorize_invoke_command(self, string):
        

        final_string = string

        try:

            # Line headers
            try:
                for token in ['START', 'END', 'REPORT', '[DEBUG]']:
                    if token in final_string:
                        format_string = '[{}]'
                        # match whole words only
                        pattern = r'\b{}\b'
                        if token == '[DEBUG]':
                            format_string = '{}'
                            pattern = re.escape(token)
                        repl = click.style(
                            format_string.format(token),
                            bold=True,
                            fg='cyan'
                        )
                        final_string = re.sub(
                            pattern.format(token), repl, final_string
                        )
            except Exception: # pragma: no cover
                pass

            # Green bold Tokens
            try:
                for token in [
                    'Zappa Event:',
                    'RequestId:',
                    'Version:',
                    'Duration:',
                    'Billed',
                    'Memory Size:',
                    'Max Memory Used:'
                ]:
                    if token in final_string:
                        final_string = final_string.replace(token, click.style(
                            token,
                            bold=True,
                            fg='green'
                        ))
            except Exception: # pragma: no cover
                pass

            # UUIDs
            for token in final_string.replace('\t', ' ').split(' '):
                try:
                    if token.count('-') is 4 and token.replace('-', '').isalnum():
                        final_string = final_string.replace(
                            token,
                            click.style(token, fg='magenta')
                        )
                except Exception: # pragma: no cover
                    pass

            return final_string
        except Exception:
            return string
1117907
def magenta(cls, string, auto=False):
        
        return cls.colorize('magenta', string, auto=auto)
972750
def create_color_method(color, code):
    

    def func(self, content=''):
        return self._apply_color(code, content)  # pylint: disable=protected-access

    setattr(Terminal, color, func)
214853
def auto_string_formatter(func):
    
    @wraps(func)
    def auto_string_formatter_wrapper(function, *args, **kwargs):
        if isinstance(function, string_types):
            function = StringFormatter(function)

        return func(function, *args, **kwargs)

    return auto_string_formatter_wrapper
435069
def _highlight(string, color):
	''''''
	if CONFIG['color']:
		if color < 8:
			return '\033[{color}m{string}\033[0m'.format(string = string, color = color+30)
		else:
			return '\033[{color}m{string}\033[0m'.format(string = string, color = color+82)
	else:
		return string
259112
private String morphColor(String str) {
		if (str.equals("")) {
			return "#000000";
		}
		if (str.equals("white")) {
			return "#ffffff";
		}
		if (str.equals("black")) {
			return "#000000";
		}
		
		return str;
	}
1208193
def basic_color(code):
    
    def inner(text, rl=False):
        """ Every raw_input with color sequences should be called with
        rl=True to avoid readline messed up the length calculation
        """
        c = code
        if rl:
            return "\001\033[%sm\002%s\001\033[0m\002" % (c, text)
        else:
            return "\033[%sm%s\033[0m" % (c, text)
    return inner
1205487
public static function fromRgbaString(string $string) : TransparentColour
    {
        list($r, $g, $b, $a) = ColourStringParser::parseRgbaString($string);

        return new self(new Colour($r, $g, $b), $a);
    }
1207784
def code2color(color_string):
    """"""

    color_tuple = ast.literal_eval(color_string)
    color_tuple_int = map(lambda x: int(x * 255.0), color_tuple)

    return wx.Colour(*color_tuple_int)
268071
def coloringfromstring(s):
    
    try:
        AST = compiler.parse(s)
    except SyntaxError:
        return
    else:
        try:
            if len(AST.getChildren()) > 1:
                ST = AST.getChildren()[1]
                if isinstance(ST, Stmt) and isinstance(ST.getChildren()[0],
                                                                     Discard):
                    d = ST.getChildren()[0].asList()[0]
        except (TypeError, AttributeError):
            pass
        else:
            if isinstance(d,Dict) and len(d.items) > 0:
                if all([isctype(i[0],str) for i in d.items]):
                    if all([isinstance(i[1],List) for i in d.items]):
                        if all([all([isctype(j,str) for j in i[1]]) for i in 
                                                                      d.items]):
                            return eval(s)
332761
def colorize(string, color, *args, **kwargs):
    
    string = string.format(*args, **kwargs)
    return color + string + colorama.Fore.RESET
356582
def bgblack(cls, string, auto=False):
        
        return cls.colorize('bgblack', string, auto=auto)
337671
def kind_as_string(self, add_colour=True):
        '''

        '''
        with self._mutex:
            if self.kind == self.PERIODIC:
                result = 'Periodic', ['reset']
            elif self.kind == self.EVENT_DRIVEN:
                result = 'Event-driven', ['reset']
            elif self.kind == self.OTHER:
                result = 'Other', ['reset']
        if add_colour:
            return utils.build_attr_string(result[1], supported=add_colour) + \
                    result[0] + utils.build_attr_string('reset', supported=add_colour)
        else:
            return result[0]
448140
public static function fromHexString(string $string) : Colour
    {
        list($r, $g, $b) = ColourStringParser::parseHexString($string);

        return new self($r, $g, $b);
    }
1130842
def autoconvert(string):
    """"""
    for fn in (boolify, int, float):
        try:
            return fn(string)
        except ValueError:
            pass
    return string