Color Names taken from http://www.w3schools.com/htmL/html_colornames.asp
541395
private void loadStandardHtmlColors() {

		if (standardHtmlColorNames==null) {
			standardHtmlColorNames = new Hashtable<String,Color>();
			addStandardHtmlColor( "AliceBlue" 	, new Color(0xF0F8FF));
			addStandardHtmlColor( "AntiqueWhite" 	, new Color(0xFAEBD7));
			addStandardHtmlColor( "Aqua" 	, new Color(0x00FFFF));
			addStandardHtmlColor( "Aquamarine" 	, new Color(0x7FFFD4));
			addStandardHtmlColor( "Azure" 	, new Color(0xF0FFFF));
			addStandardHtmlColor( "Beige" 	, new Color(0xF5F5DC));
			addStandardHtmlColor( "Bisque" 	, new Color(0xFFE4C4));
			addStandardHtmlColor( "Black" 	, new Color(0x000000));
			addStandardHtmlColor( "BlanchedAlmond" 	, new Color(0xFFEBCD));
			addStandardHtmlColor( "Blue" 	, new Color(0x0000FF));
			addStandardHtmlColor( "BlueViolet" 	, new Color(0x8A2BE2));
			addStandardHtmlColor( "Brown" 	, new Color(0xA52A2A));
			addStandardHtmlColor( "BurlyWood" 	, new Color(0xDEB887));
			addStandardHtmlColor( "CadetBlue" 	, new Color(0x5F9EA0));
			addStandardHtmlColor( "Chartreuse" 	, new Color(0x7FFF00));
			addStandardHtmlColor( "Chocolate" 	, new Color(0xD2691E));
			addStandardHtmlColor( "Coral" 	, new Color(0xFF7F50));
			addStandardHtmlColor( "CornflowerBlue" 	, new Color(0x6495ED));
			addStandardHtmlColor( "Cornsilk" 	, new Color(0xFFF8DC));
			addStandardHtmlColor( "Crimson" 	, new Color(0xDC143C));
			addStandardHtmlColor( "Cyan" 	, new Color(0x00FFFF));
			addStandardHtmlColor( "DarkBlue" 	, new Color(0x00008B));
			addStandardHtmlColor( "DarkCyan" 	, new Color(0x008B8B));
			addStandardHtmlColor( "DarkGoldenRod" 	, new Color(0xB8860B));
			addStandardHtmlColor( "DarkGray" 	, new Color(0xA9A9A9));
			addStandardHtmlColor( "DarkGreen" 	, new Color(0x006400));
			addStandardHtmlColor( "DarkKhaki" 	, new Color(0xBDB76B));
			addStandardHtmlColor( "DarkMagenta" 	, new Color(0x8B008B));
			addStandardHtmlColor( "DarkOliveGreen" 	, new Color(0x556B2F));
			addStandardHtmlColor( "DarkOrange" 	, new Color(0xFF8C00));
			addStandardHtmlColor( "DarkOrchid" 	, new Color(0x9932CC));
			addStandardHtmlColor( "DarkRed" 	, new Color(0x8B0000));
			addStandardHtmlColor( "DarkSalmon" 	, new Color(0xE9967A));
			addStandardHtmlColor( "DarkSeaGreen" 	, new Color(0x8FBC8F));
			addStandardHtmlColor( "DarkSlateBlue" 	, new Color(0x483D8B));
			addStandardHtmlColor( "DarkSlateGray" 	, new Color(0x2F4F4F));
			addStandardHtmlColor( "DarkTurquoise" 	, new Color(0x00CED1));
			addStandardHtmlColor( "DarkViolet" 	, new Color(0x9400D3));
			addStandardHtmlColor( "DeepPink" 	, new Color(0xFF1493));
			addStandardHtmlColor( "DeepSkyBlue" 	, new Color(0x00BFFF));
			addStandardHtmlColor( "DimGray" 	, new Color(0x696969));
			addStandardHtmlColor( "DodgerBlue" 	, new Color(0x1E90FF));
			addStandardHtmlColor( "FireBrick" 	, new Color(0xB22222));
			addStandardHtmlColor( "FloralWhite" 	, new Color(0xFFFAF0));
			addStandardHtmlColor( "ForestGreen" 	, new Color(0x228B22));
			addStandardHtmlColor( "Fuchsia" 	, new Color(0xFF00FF));
			addStandardHtmlColor( "Gainsboro" 	, new Color(0xDCDCDC));
			addStandardHtmlColor( "GhostWhite" 	, new Color(0xF8F8FF));
			addStandardHtmlColor( "Gold" 	, new Color(0xFFD700));
			addStandardHtmlColor( "GoldenRod" 	, new Color(0xDAA520));
			addStandardHtmlColor( "Gray" 	, new Color(0x808080));
			addStandardHtmlColor( "Green" 	, new Color(0x008000));
			addStandardHtmlColor( "GreenYellow" 	, new Color(0xADFF2F));
			addStandardHtmlColor( "HoneyDew" 	, new Color(0xF0FFF0));
			addStandardHtmlColor( "HotPink" 	, new Color(0xFF69B4));
			addStandardHtmlColor( "IndianRed " 	, new Color(0xCD5C5C));
			addStandardHtmlColor( "Indigo " 	, new Color(0x4B0082));
			addStandardHtmlColor( "Ivory" 	, new Color(0xFFFFF0));
			addStandardHtmlColor( "Khaki" 	, new Color(0xF0E68C));
			addStandardHtmlColor( "Lavender" 	, new Color(0xE6E6FA));
			addStandardHtmlColor( "LavenderBlush" 	, new Color(0xFFF0F5));
			addStandardHtmlColor( "LawnGreen" 	, new Color(0x7CFC00));
			addStandardHtmlColor( "LemonChiffon" 	, new Color(0xFFFACD));
			addStandardHtmlColor( "LightBlue" 	, new Color(0xADD8E6));
			addStandardHtmlColor( "LightCoral" 	, new Color(0xF08080));
			addStandardHtmlColor( "LightCyan" 	, new Color(0xE0FFFF));
			addStandardHtmlColor( "LightGoldenRodYellow" 	, new Color(0xFAFAD2));
			addStandardHtmlColor( "LightGray" 	, new Color(0xD3D3D3));
			addStandardHtmlColor( "LightGreen" 	, new Color(0x90EE90));
			addStandardHtmlColor( "LightPink" 	, new Color(0xFFB6C1));
			addStandardHtmlColor( "LightSalmon" 	, new Color(0xFFA07A));
			addStandardHtmlColor( "LightSeaGreen" 	, new Color(0x20B2AA));
			addStandardHtmlColor( "LightSkyBlue" 	, new Color(0x87CEFA));
			addStandardHtmlColor( "LightSlateGray" 	, new Color(0x778899));
			addStandardHtmlColor( "LightSteelBlue" 	, new Color(0xB0C4DE));
			addStandardHtmlColor( "LightYellow" 	, new Color(0xFFFFE0));
			addStandardHtmlColor( "Lime" 	, new Color(0x00FF00));
			addStandardHtmlColor( "LimeGreen" 	, new Color(0x32CD32));
			addStandardHtmlColor( "Linen" 	, new Color(0xFAF0E6));
			addStandardHtmlColor( "Magenta" 	, new Color(0xFF00FF));
			addStandardHtmlColor( "Maroon" 	, new Color(0x800000));
			addStandardHtmlColor( "MediumAquaMarine" 	, new Color(0x66CDAA));
			addStandardHtmlColor( "MediumBlue" 	, new Color(0x0000CD));
			addStandardHtmlColor( "MediumOrchid" 	, new Color(0xBA55D3));
			addStandardHtmlColor( "MediumPurple" 	, new Color(0x9370DB));
			addStandardHtmlColor( "MediumSeaGreen" 	, new Color(0x3CB371));
			addStandardHtmlColor( "MediumSlateBlue" 	, new Color(0x7B68EE));
			addStandardHtmlColor( "MediumSpringGreen" 	, new Color(0x00FA9A));
			addStandardHtmlColor( "MediumTurquoise" 	, new Color(0x48D1CC));
			addStandardHtmlColor( "MediumVioletRed" 	, new Color(0xC71585));
			addStandardHtmlColor( "MidnightBlue" 	, new Color(0x191970));
			addStandardHtmlColor( "MintCream" 	, new Color(0xF5FFFA));
			addStandardHtmlColor( "MistyRose" 	, new Color(0xFFE4E1));
			addStandardHtmlColor( "Moccasin" 	, new Color(0xFFE4B5));
			addStandardHtmlColor( "NavajoWhite" 	, new Color(0xFFDEAD));
			addStandardHtmlColor( "Navy" 	, new Color(0x000080));
			addStandardHtmlColor( "OldLace" 	, new Color(0xFDF5E6));
			addStandardHtmlColor( "Olive" 	, new Color(0x808000));
			addStandardHtmlColor( "OliveDrab" 	, new Color(0x6B8E23));
			addStandardHtmlColor( "Orange" 	, new Color(0xFFA500));
			addStandardHtmlColor( "OrangeRed" 	, new Color(0xFF4500));
			addStandardHtmlColor( "Orchid" 	, new Color(0xDA70D6));
			addStandardHtmlColor( "PaleGoldenRod" 	, new Color(0xEEE8AA));
			addStandardHtmlColor( "PaleGreen" 	, new Color(0x98FB98));
			addStandardHtmlColor( "PaleTurquoise" 	, new Color(0xAFEEEE));
			addStandardHtmlColor( "PaleVioletRed" 	, new Color(0xDB7093));
			addStandardHtmlColor( "PapayaWhip" 	, new Color(0xFFEFD5));
			addStandardHtmlColor( "PeachPuff" 	, new Color(0xFFDAB9));
			addStandardHtmlColor( "Peru" 	, new Color(0xCD853F));
			addStandardHtmlColor( "Pink" 	, new Color(0xFFC0CB));
			addStandardHtmlColor( "Plum" 	, new Color(0xDDA0DD));
			addStandardHtmlColor( "PowderBlue" 	, new Color(0xB0E0E6));
			addStandardHtmlColor( "Purple" 	, new Color(0x800080));
			addStandardHtmlColor( "RebeccaPurple" 	, new Color(0x663399));
			addStandardHtmlColor( "Red" 	, new Color(0xFF0000));
			addStandardHtmlColor( "RosyBrown" 	, new Color(0xBC8F8F));
			addStandardHtmlColor( "RoyalBlue" 	, new Color(0x4169E1));
			addStandardHtmlColor( "SaddleBrown" 	, new Color(0x8B4513));
			addStandardHtmlColor( "Salmon" 	, new Color(0xFA8072));
			addStandardHtmlColor( "SandyBrown" 	, new Color(0xF4A460));
			addStandardHtmlColor( "SeaGreen" 	, new Color(0x2E8B57));
			addStandardHtmlColor( "SeaShell" 	, new Color(0xFFF5EE));
			addStandardHtmlColor( "Sienna" 	, new Color(0xA0522D));
			addStandardHtmlColor( "Silver" 	, new Color(0xC0C0C0));
			addStandardHtmlColor( "SkyBlue" 	, new Color(0x87CEEB));
			addStandardHtmlColor( "SlateBlue" 	, new Color(0x6A5ACD));
			addStandardHtmlColor( "SlateGray" 	, new Color(0x708090));
			addStandardHtmlColor( "Snow" 	, new Color(0xFFFAFA));
			addStandardHtmlColor( "SpringGreen" 	, new Color(0x00FF7F));
			addStandardHtmlColor( "SteelBlue" 	, new Color(0x4682B4));
			addStandardHtmlColor( "Tan" 	, new Color(0xD2B48C));
			addStandardHtmlColor( "Teal" 	, new Color(0x008080));
			addStandardHtmlColor( "Thistle" 	, new Color(0xD8BFD8));
			addStandardHtmlColor( "Tomato" 	, new Color(0xFF6347));
			addStandardHtmlColor( "Turquoise" 	, new Color(0x40E0D0));
			addStandardHtmlColor( "Violet" 	, new Color(0xEE82EE));
			addStandardHtmlColor( "Wheat" 	, new Color(0xF5DEB3));
			addStandardHtmlColor( "White" 	, new Color(0xFFFFFF));
			addStandardHtmlColor( "WhiteSmoke" 	, new Color(0xF5F5F5));
			addStandardHtmlColor( "Yellow" 	, new Color(0xFFFF00));
			addStandardHtmlColor( "YellowGreen" 	, new Color(0x9ACD32));
			log.debug("Standard HTML color names loaded.");
		}
	}
1195146
def html_table_color(row, item, color=(0, 0, 0)):
    
    result = [0, 0, 0]
    color_list = color_check(color)
    max_color = max(color_list)
    back_color_index = 255 - int((item / (sum(list(row.values())) + 1)) * 255)
    for i in range(3):
        result[i] = back_color_index - (max_color - color_list[i])
        if result[i] < 0:
            result[i] = 0
    return result
1006860
def _build_color_variants(cls):
    
    # Get the basic frame types first.
    frametypes = cls.sets(registered=False)

    _colornames = [
        # 'black', disabled for now, it won't show on my terminal.
        'red',
        'green',
        'yellow',
        'blue',
        'magenta',
        'cyan',
        'white',
    ]
    _colornames.extend('light{}'.format(s) for s in _colornames[:])
    for colorname in _colornames:
        for framesobj in frametypes:
            framename = '{}_{}'.format(framesobj.name, colorname)
            cls.register(
                framesobj.as_colr(fore=colorname),
                name=framename,
            )
950489
protected function defineColors()
    {
        $this->colors = array(
            'blue'    => chr(27).'[1;34m',
            'red'     => chr(27).'[1;31m',
            'green'   => chr(27).'[1;32m',
            'yellow'  => chr(27).'[1;33m',
            'black'   => chr(27).'[1;30m',
            'magenta' => chr(27).'[1;35m',
            'cyan'    => chr(27).'[1;36m',
            'white'   => chr(27).'[1;37m',
            'grey'    => chr(27).'[0;37m',
            'reset'   => chr(27).'[0m',
        );
    }
893166
function() {
            var rgb = this.get(this.OPT.RGB),
                websafe = this.get(this.OPT.WEBSAFE),
                el = this.getElement(this.ID.SWATCH),
                color = rgb.join(","),
                txt = this.get(this.OPT.TXT);

            Dom.setStyle(el, "background-color", "rgb(" + color  + ")");
            el.title = sub(txt.CURRENT_COLOR, {
                    "rgb": "#" + this.get(this.OPT.HEX)
                });


            el = this.getElement(this.ID.WEBSAFE_SWATCH);
            color = websafe.join(",");

            Dom.setStyle(el, "background-color", "rgb(" + color + ")");
            el.title = sub(txt.CLOSEST_WEBSAFE, {
                    "rgb": "#" + Color.rgb2hex(websafe)
                });

        }
1344209
function getColors(rawData) {

    // Regular expression matching colors variables naming pattern
    var REGEX = /^dc-(.*?)[0-9]+$/;

    var content = rawData
        .filter((item) => {
            var group = item.group[0];
            return group === 'colors'
                && item.context.type === 'variable'
                && item.context.name.match(REGEX);
        })
        .map((item) => {
            // extract color name (eg. `dc-magenta10 -> magenta`)
            item.color = item.context.name.replace(REGEX, '$1');
            item.color = _.capitalize(item.color);
            return item;
        });

    // transform colors array in a object, shaped as the view layer expect
    content = _.groupBy(content, (c) => c.color );
    Object.keys(content).forEach((color) => {
        content[color] = content[color].reduce((acc, c) => {
            acc['$' + c.context.name] = c.context.value;
            return acc;
        }, {});
    });
    return content;
}
369855
def getColor(name):
    
    try:
        c = getColorInfoList()[getColorList().index(name.upper())]
        return (c[1] / 255., c[2] / 255., c[3] / 255.)
    except:
        return (1, 1, 1)
412085
def color_key(tkey):
    
    name = tkey.GetName()
    classname = tkey.GetClassName()
    for class_regex, color in _COLOR_MATCHER:
        if class_regex.match(classname):
            return colored(name, color=color)
    return name
1104348
function(css) {
                css = trim(css);

                var withInteger = match(rgb_rgba_integer_regex, 255);
                if (withInteger) {
                    return withInteger;
                }
                return match(rgb_rgba_percentage_regex, 100);

                function match(regex, max_value) {
                    var colorGroups = css.match(regex);

                    // If there is an "a" after "rgb", there must be a fourth parameter and the other way round
                    if (!colorGroups || (!!colorGroups[1] + !!colorGroups[5] === 1)) {
                        return null;
                    }

                    var rgb = factories.RGB();
                    rgb.red = Math.min(1, Math.max(0, colorGroups[2] / max_value));
                    rgb.green = Math.min(1, Math.max(0, colorGroups[3] / max_value));
                    rgb.blue = Math.min(1, Math.max(0, colorGroups[4] / max_value));
                    rgb.alpha = !!colorGroups[5] ? Math.min(Math.max(parseFloat(colorGroups[6]), 0), 1) : 1;

                    return rgb;
                }
            }
1081983
def get_colors(n):
        """"""
        cb_palette = ["#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00",
                      "#CC79A7","#001F3F", "#0074D9", "#7FDBFF", "#39CCCC", "#3D9970", "#2ECC40",
                       "#01FF70", "#FFDC00", "#FF851B", "#FF4136", "#F012BE", "#B10DC9",
                       "#85144B", "#AAAAAA", "#000000"]

        whole = int(n/22)
        extra = (n % 22)
        cols = cb_palette * whole
        if extra >= 0:
            cols.extend(cb_palette[0:extra])
        return cols
812153
def color(type, str)
      colors = {
        'pass'          => [:green], # 90,
        'fail'          => [:red], # 31,
        'bright pass'   => [:bold, :green], # 92,
        'bright fail'   => [:bold, :red], # 91,
        'bright yellow' => [:bold, :yellow], # 93,
        'pending'       => [:yellow], # 36,
        'suite'         => [], # 0,
        'error title'   => [], # 0,
        'error message' => [:red], # 31,
        'error stack'   => [:green], # 90,
        'checkmark'     => [:green], # 32,
        'fast'          => [:green], # 90,
        'medium'        => [:green], # 33,
        'slow'          => [:red], # 31,
        'green'         => [:green], # 32,
        'light'         => [:green], # 90,
        'diff gutter'   => [:green], # 90,
        'diff added'    => [:green], # 42,
        'diff removed'  => [:red]# 41
      }

      @context.knife.ui.color(str, *colors[type])
    end
1322242
def color(self, s, color=None, bold=False):
        
        if not self.enable:
            return s
        code_seq = []
        if color:
            code_seq += [30 + self.ColorIdxTable[color]]  # foreground color
        if bold:
            code_seq += [1]
        if not code_seq:
            return s
        start = "\x1b[%sm" % ";".join(map(str, code_seq))
        end = "\x1b[0m"
        while s[:1] == " ":  # move prefix spaces outside
            start = " " + start
            s = s[1:]
        while s[-1:] == " ":  # move postfix spaces outside
            end += " "
            s = s[:-1]
        return start + s + end
1102473
protected function validate($data) {
        /**
         * List of valid HTML colour names
         *
         * @var array
         */
         $colornames = array(
            'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure',
            'beige', 'bisque', 'black', 'blanchedalmond', 'blue',
            'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse',
            'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson',
            'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray',
            'darkgrey', 'darkgreen', 'darkkhaki', 'darkmagenta',
            'darkolivegreen', 'darkorange', 'darkorchid', 'darkred',
            'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray',
            'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink',
            'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick',
            'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro',
            'ghostwhite', 'gold', 'goldenrod', 'gray', 'grey', 'green',
            'greenyellow', 'honeydew', 'hotpink', 'indianred', 'indigo',
            'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen',
            'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan',
            'lightgoldenrodyellow', 'lightgray', 'lightgrey', 'lightgreen',
            'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue',
            'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow',
            'lime', 'limegreen', 'linen', 'magenta', 'maroon',
            'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple',
            'mediumseagreen', 'mediumslateblue', 'mediumspringgreen',
            'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream',
            'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive',
            'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod',
            'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip',
            'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'red',
            'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown',
            'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue',
            'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan',
            'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white',
            'whitesmoke', 'yellow', 'yellowgreen'
        );

        if (preg_match('/^#?([[:xdigit:]]{3}){1,2}$/', $data)) {
            if (strpos($data, '#')!==0) {
                $data = '#'.$data;
            }
            return $data;
        } else if (in_array(strtolower($data), $colornames)) {
            return $data;
        } else if (preg_match('/rgb\(\d{0,3}%?\, ?\d{0,3}%?, ?\d{0,3}%?\)/i', $data)) {
            return $data;
        } else if (preg_match('/rgba\(\d{0,3}%?\, ?\d{0,3}%?, ?\d{0,3}%?\, ?\d(\.\d)?\)/i', $data)) {
            return $data;
        } else if (preg_match('/hsl\(\d{0,3}\, ?\d{0,3}%, ?\d{0,3}%\)/i', $data)) {
            return $data;
        } else if (preg_match('/hsla\(\d{0,3}\, ?\d{0,3}%,\d{0,3}%\, ?\d(\.\d)?\)/i', $data)) {
            return $data;
        } else if (($data == 'transparent') || ($data == 'currentColor') || ($data == 'inherit')) {
            return $data;
        } else if (empty($data)) {
            if ($this->usedefaultwhenempty){
                return $this->defaultsetting;
            } else {
                return '';
            }
        } else {
            return false;
        }
    }
84780
function getColor(varName, mappings) {
  const color = mappings[varName];
  if (color in mappings) {
    return getColor(color, mappings);
  } else {
    return color;
  }
}
1237190
function getColorGroups(colors) {
  var colorGroups = [];

  colors.forEach(function (color) {
    if (colorGroups.indexOf(color.group) < 0) {
      colorGroups.push(color.group);
    }
  });

  return colorGroups;
}
632835
function getCSSText(className) {
			if (typeof document.styleSheets != "object") return "";
			if (document.styleSheets.length <= 0) return "";
			var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
			for (var x = 0; x < classes.length; x++) {
				if (classes[x].selectorText == "." + className || classes[x].selectorText == "#" + className) {
					return ((classes[x].cssText) ? (classes[x].cssText) : (classes[x].style.cssText));
				}
			}
			return "";
		}
1243376
function getColorStr(color) {
    var hex = color.hexString();
    var alpha = getAlphaHex(color.alpha());
    var colorStr = '#' + alpha + hex.slice(1);

    return colorStr.toLowerCase();
}