returns the colorized text for the given severity level
165062
function getColorSeverity(severity) {
    // get the color associated with the severity level
    const color = severityMap[severity] || 'white';
    return chalk[color].bold(severity.toUpperCase());
}
1054763
def yellow(cls, string, auto=False):
        
        return cls.colorize('yellow', string, auto=auto)
1169650
def get_text(self, node):
        """"""
        return click.style(
            repr(node), fg='green' if node.level > 1 else 'red'
        )
1188350
def get_formatted_contents(
    raw_contents,
    use_color,
    color_config,
    squeeze,
    subs
):
    
    result = raw_contents

    if use_color:
        result = get_colorized_contents(result, color_config)

    if squeeze:
        result = get_squeezed_contents(result)

    if subs:
        result = get_substituted_contents(result, subs)

    return result
859091
def red(cls, string, auto=False):
        
        return cls.colorize('red', string, auto=auto)
1272927
function highlightTokens(defs: Object, text: string) {
  return text.replace(jsTokens, function(...args) {
    const type = getTokenType(args);
    const colorize = defs[type];
    if (colorize) {
      return args[0]
        .split(NEWLINE)
        .map(str => colorize(str))
        .join("\n");
    } else {
      return args[0];
    }
  });
}
387796
def to_text(self):
        
        if self.text is None:
            return

        level = '*' * self.level
        return '%s%s\n' % (level, self.text)
1111039
def black_invariant(text, chars=None):
    """"""
    if chars is None:
        chars = [' ', '\t', '\n', ',', "'", '"', '(', ')', '\\']

    for char in chars:
        text = text.replace(char, '')
    return text
1079036
function formatBufferColored(err, options) {
    // istanbul ignore else
    if (!hex) {
        return err.buffer.toString('hex');
    }

    options = options || {};
    var opts = options.hexerOptions ? Object.create(options.hexerOptions) : {};
    if (opts.colored === undefined) {
        opts.colored = true;
    }
    var highlight = errorHighlighter(err, options);
    opts.decorateHexen = highlight;
    opts.decorateHuman = highlight;
    return hex(err.buffer, opts);
}
1341138
def yellow(cls):
        ""
        wAttributes = cls._get_text_attributes()
        wAttributes &= ~win32.FOREGROUND_MASK
        wAttributes |=  win32.FOREGROUND_YELLOW
        cls._set_text_attributes(wAttributes)
1142382
def bk_red(cls):
        ""
        wAttributes = cls._get_text_attributes()
        wAttributes &= ~win32.BACKGROUND_MASK
        wAttributes |=  win32.BACKGROUND_RED
        cls._set_text_attributes(wAttributes)
1182898
def _colorize_single_line(line, regexp, color_def):
    """"""
    match = regexp.match(line)
    groupdict = match.groupdict()
    groups = match.groups()
    if not groupdict:
        # no named groups, just colorize whole line
        color = color_def[0]
        dark = color_def[1]
        cprint("%s\n" % line, color, fg_dark=dark)
    else:
        rev_groups = {v: k for k, v in groupdict.items()}
        for part in groups:
            if part in rev_groups and rev_groups[part] in color_def:
                group_name = rev_groups[part]
                cprint(
                    part,
                    color_def[group_name][0],
                    fg_dark=color_def[group_name][1],
                )
            else:
                cprint(part)
        cprint("\n")
331502
function _formatStatus(status) {
    let statusColorFn = chalk.grey;
    if (_.endsWith(status, 'IN_PROGRESS')) {
        statusColorFn = chalk.yellow;
    } else if (_.endsWith(status, 'FAILED') || _.startsWith(status, 'DELETE')) {
        statusColorFn = chalk.red;
    } else if (_.endsWith(status, 'COMPLETE')) {
        statusColorFn = chalk.greenBright;
    }

    const sanitizedStatus = _.replace(status, '_', ' ');
    const paddedStatus = _.padEnd(sanitizedStatus, STACK_EVENT_STATUS_DISPLAY_LENGTH);
    return statusColorFn(paddedStatus);
}
1205962
def colour_hsv(self):
        """"""
        hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR]
        return BulbDevice._hexvalue_to_hsv(hexvalue)
863366
def _color(self, color, msg):
        
        if self.useColor:
            return '{0}{1}{2}'.format(color, msg, self.RESET_SEQ)
        else:
            return msg
933308
def color_text(text, color):
    
    """
    import utool as ut
    if color is None or not ENABLE_COLORS:
        return text
    elif color == 'python':
        return highlight_text(text, color)
    elif color == 'sql':
        return highlight_text(text, 'sql')
    try:
        import pygments
        import pygments.console
        # if color == 'guess':
        #     import linguist  # NOQA
        #     pygments.lexers.guess_lexer(text)
        #     return highlight_text(text, color)
        ansi_text = pygments.console.colorize(color, text)
        if ut.WIN32:
            import colorama
            ansi_reset = (colorama.Style.RESET_ALL)
        else:
            ansi_reset = pygments.console.colorize('reset', '')
        ansi_text = ansi_text + ansi_reset
        return ansi_text
    except ImportError:
        return text
1130665
def output_colored(code, text, is_bold=False):
    
    if is_bold:
        code = '1;%s' % code

    return '\033[%sm%s\033[0m' % (code, text)