Returns colored string
323413
public static function printColored ($string, $foreground_color = null, $background_color = null) {
		$colored_string = "";

		// Check if given foreground color found
		if (isset(Bartender::$foreground_colors[$foreground_color])) {
			$colored_string .= "\033[" . Bartender::$foreground_colors[$foreground_color] . "m";
		}
		// Check if given background color found
		if (isset(Bartender::$background_colors[$background_color])) {
			$colored_string .= "\033[" . Bartender::$background_colors[$background_color] . "m";
		}

		// Add string and end coloring
		$colored_string .=  $string;

		echo $colored_string;
	}
193177
function stripColor(str) {
    while (true) {
        var i = str.indexOf('\x1b[');
        if (i < 0) return str;
        var j = str.indexOf('m', i);
        if (j < 0) return str;
        str = str.slice(0, i) + str.slice(j + 1);
    }
}
287657
def colors(self):
        """"""
        try:
            return get_console_info(self._kernel32, self._stream_handle)[:2]
        except OSError:
            return WINDOWS_CODES['white'], WINDOWS_CODES['black']
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)
892120
function getColorObj(text) {
  const hashedText = hash(text);
  const colorIndex = hashedText % materialColors.length;

  return materialColors[colorIndex];
}
988665
def toString( self ):
        
        # convert the element tree information
        from xml.etree import ElementTree
        
        xelem = ElementTree.Element('colorset')
        xelem.set('name', self.name())
        xelem.set('colorGroups', ','.join(self.colorGroups()))
        
        for colorName, colors in self._colors.items():
            xcolor = ElementTree.SubElement(xelem, 'color')
            xcolor.set('name', colorName)
            
            for colorGroup, color in colors.items():
                xcolorval = ElementTree.SubElement(xcolor, 'value')
                xcolorval.set('group', colorGroup)
                xcolorval.set('red',    str(color.red()))
                xcolorval.set('green',  str(color.green()))
                xcolorval.set('blue',   str(color.blue()))
                xcolorval.set('alpha',  str(color.alpha()))
        
        # save the text
        return ElementTree.tostring(xelem)
1199883
def color(self, log_colors, level_name):
        """"""
        if not self.stream.isatty():
            log_colors = {}
        return ColoredFormatter.color(self, log_colors, level_name)
138962
private String checkColor(String color) {

        if (color != null) {
            if (color.indexOf("#") == -1) {
                // add the "#" to the color string
                color = "#" + color;
            }
            int colLength = color.length();
            if ((colLength == 4) || (colLength == 7)) {
                return color;
            }
        }
        return "#FFFFFF";
    }
920050
def formatcolor(string, fg=None, bg=None):
    
    if fg is bg is None:
        return string

    temp = (['fg='+fg] if fg else []) +\
           (['bg='+bg] if bg else [])
    fmt = _color_format_parser._COLOR_DELIM.join(temp)

    return _color_format_parser._START_TOKEN + fmt +\
        _color_format_parser._FMT_TOKEN + string +\
        _color_format_parser._STOP_TOKEN
686814
def get_colorized_contents(contents, color_config):
    """"""
    colorizer = color.EgColorizer(color_config)
    result = colorizer.colorize_text(contents)
    return result
354622
def colorize(str, sev: :normal_s)
      return str unless color_enabled?

      cc = COLOR_CODE
      color = cc.key?(sev) ? cc[sev] : ''
      "#{color}#{str.sub(cc[:esc_m], color)}#{cc[:esc_m]}"
    end
1101539
function convertColorToString(color) {
  const {type, values} = color

  // Only convert the first 3 values to int (i.e. not alpha)
  if (type.indexOf('rgb') > -1)
    for (let i = 0; i < 3; i++) values[i] = parseInt(values[i])

  let colorString

  if (type.indexOf('hsl') > -1)
    colorString = `${color.type}(${values[0]}, ${values[1]}%, ${values[2]}%`
  else colorString = `${color.type}(${values[0]}, ${values[1]}, ${values[2]}`

  if (values.length === 4) colorString += `, ${color.values[3].toFixed(2)})`
  else colorString += ')'

  return colorString
}
479238
function string_to_color(str) {
	// Generate a Hash for the String
	var hash = function(word) {
		var h = 0;
		for (var i = 0; i < word.length; i++) {
			h = word.charCodeAt(i) + ((h << 5) - h);
		}
		return h;
	};

	// Change the darkness or lightness
	var shade = function(color, prc) {
		var num = parseInt(color, 16),
		    amt = Math.round(2.55 * prc),
		    R = (num >> 16) + amt,
		    G = (num >> 8 & 0x00FF) + amt,
		    B = (num & 0x0000FF) + amt;
		return (0x1000000 + (R < 255 ? R < 1 ? 0 : R : 255) * 0x10000 +
			(G < 255 ? G < 1 ? 0 : G : 255) * 0x100 +
			(B < 255 ? B < 1 ? 0 : B : 255))
			.toString(16)
			.slice(1);
	};

	// Convert init to an RGBA
	var int_to_rgba = function(i) {
		var color = ((i >> 24) & 0xFF).toString(16) +
			((i >> 16) & 0xFF).toString(16) +
			((i >> 8) & 0xFF).toString(16) +
			(i & 0xFF).toString(16);
		return color;
	};

	return shade(
		int_to_rgba(hash(str)),
		-10
	);
}
1041983
def stringc(text, color):
    
    if has_colors:
        text = str(text)

        return "\033["+codeCodes[color]+"m"+text+"\033[0m"
    else:
        return text
1170435
public static Color stringToColor(String str) {
    int icol = SVG_COLOR_NAMES.getInt(str.toLowerCase());
    if(icol != NO_VALUE) {
      return new Color(icol, false);
    }
    return colorLookupStylesheet.stringToColor(str);
  }
1205961
public static String toColorShorthand(String red, String green, String blue) {
		return shorthandHex(toColor(red, green, blue));
	}
696493
def color_msg(msg, color):
    "  "
    return ''.join((COLORS.get(color, COLORS['endc']), msg, COLORS['endc']))