<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'AS3 HTML Color Keywords (ColorName Class)'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 14 Apr 2026 20:18:46 +0000</lastBuildDate>
    <item>
      <title>burnandbass said on 26/Dec/2010</title>
      <link>https://snipplr.com/view/46082/as3-html-color-keywords-colorname-class</link>
      <description>&lt;p&gt;I got something like this:&#13;
&#13;
&#13;
package bab.utils{&#13;
	import flash.errors.*;&#13;
	public class Colors &#13;
	{&#13;
		static private var colors:Hash = new Hash( {&#13;
			"aqua": 		0x00ffff,&#13;
			"black":		0x000000,&#13;
			"blue":			0x0000ff,&#13;
			"brown":		0xa52a2a,&#13;
			"cyan":			0x00ffff,&#13;
			"darkblue":		0x00008b,&#13;
			"darkcyan":		0x008b8b,&#13;
			"darkgray":		0xa9a9a9,&#13;
			"darkgrey":		0xa9a9a9,&#13;
			"darkgreen":	0x006400,&#13;
			"darkmagenta":	0x8b008b,&#13;
			"darkred":		0x8b0000,&#13;
			"deeppink":		0xff1493,&#13;
			"gold":			0xffd700,&#13;
			"gray":			0x808080,&#13;
			"grey":			0x808080,&#13;
			"green":		0x008000,&#13;
			"greenyellow":	0xadff2f,&#13;
			"lightblue":	0xadd8e6,&#13;
			"lightcyan":	0xe0ffff,&#13;
			"lightgray":	0xd3d3d3,&#13;
			"lightgrey":	0xd3d3d3,&#13;
			"lightgreen":	0x90ee90,&#13;
			"lightpink":	0xffb6c1,&#13;
			"lightyellow":	0xffffe0,&#13;
			"lime":			0x00ff00,&#13;
			"limegreen":	0x32cd32,&#13;
			"magenta":		0xff00ff,&#13;
			"pink":			0xffc0cb,&#13;
			"red":			0xff0000,&#13;
			"yellow":		0xffff00,&#13;
			"white":		0xffffff&#13;
		});&#13;
&#13;
		static public const TYPE_INT:String = "int";&#13;
		static public const TYPE_HTML:String = "html";&#13;
		&#13;
		public function Colors(){&#13;
			throw new Error("this is for using with static methods only");&#13;
			}&#13;
			&#13;
		public static function setColors(colors:Object):void {&#13;
			for (var n:String in colors){&#13;
				Colors.set(n,colors[n]);&#13;
			}&#13;
		}&#13;
		&#13;
		static public function set(name:String, c:*):void {&#13;
			if (c is String) {&#13;
				var color_num:Array = (c as String).toUpperCase().match(/^\#?([\dA-F]+)$/);&#13;
				if (color_num) {&#13;
					colors[name] = Number("0x"+color_num[1]);&#13;
				}else {&#13;
					colors[name] = get(c);&#13;
				}&#13;
			}else {&#13;
				colors[name] = c;&#13;
			}&#13;
		}&#13;
		&#13;
		static public function convertColors(hash:Hash, type:String = "int"):Hash {&#13;
			for ( var n:String in hash){&#13;
				if(n == "_color" || n == "color" || n == "backgroundColor" || n == "borderColor" || n == "_text_color"){&#13;
					hash[n] = Colors.get(hash[n],type);&#13;
				}&#13;
			}&#13;
			return hash;&#13;
		}&#13;
		&#13;
		static public function get(name:*, type:String = "int"):* {&#13;
			if(!(name is String)){&#13;
				return name;&#13;
			}&#13;
			switch(type) {&#13;
				case TYPE_HTML:&#13;
					return "#" + colors[name].toString(16);&#13;
				break;&#13;
				case TYPE_INT:&#13;
				default :&#13;
					return colors[name];&#13;
			}&#13;
		}&#13;
	}&#13;
	&#13;
}&lt;/p&gt;</description>
      <pubDate>Sun, 26 Dec 2010 13:06:00 UTC</pubDate>
      <guid>https://snipplr.com/view/46082/as3-html-color-keywords-colorname-class</guid>
    </item>
    <item>
      <title>mgeduld said on 19/Jan/2011</title>
      <link>https://snipplr.com/view/46082/as3-html-color-keywords-colorname-class</link>
      <description>&lt;p&gt;Thanks. This is really useful. I only wanted the colors as straight-forward consts, so I ran a RegExp on your list and came up with what's below (adding grays at the top)&#13;
&#13;
public static const NO_COLOR : int = -1;&#13;
&#13;
//grays&#13;
public static const GRAY10: int = 0x1A1A1A;&#13;
public static const GRAY20: int = 0x333333;&#13;
public static const GRAY30: int = 0x4D4D4D;&#13;
public static const GRAY40: int = 0x666666;&#13;
public static const GRAY50: int = 0x808080;&#13;
public static const GRAY60: int = 0x999999;&#13;
public static const GRAY70: int = 0xB3B3B3;&#13;
public static const GRAY80: int = 0xCCCCCC;&#13;
public static const GRAY90: int = 0xE5E5E5;&#13;
&#13;
//HTML4 COLOR KEYWORDS - VGA&#13;
//@see http://www.w3.org/TR/css3-color/#html4&#13;
public static const AQUA : int = 0x00FFFF;&#13;
public static const BLACK : int = 0x000000;&#13;
public static const BLUE : int = 0x0000FF;&#13;
public static const FUCHSIA : int = 0xFF00FF;&#13;
public static const GRAY : int = 0x808080;&#13;
public static const GREEN : int = 0x008000;&#13;
public static const LIME : int = 0x00FF00;&#13;
public static const MAROON : int = 0x800000;&#13;
public static const NAVY : int = 0x000080;&#13;
public static const OLIVE : int = 0x808000;&#13;
public static const PURPLE : int = 0x800080;&#13;
public static const RED : int = 0xFF0000;&#13;
public static const SILVER : int = 0xC0C0C0;&#13;
public static const TEAL : int = 0x008080;&#13;
public static const WHITE : int = 0xFFFFFF;&#13;
public static const YELLOW : int = 0xFFFF00;&#13;
&#13;
//SVG COLOR KEYWORDS - X11 ( INCLUDES THE 16 HTML4 - VGA COLORS )&#13;
//@see http://www.w3.org/TR/css3-color/#svg-color&#13;
public static const ALICE_BLUE : int = 0xF0F8FF;&#13;
public static const ANTIQUE_WHITE : int = 0xFAEBD7;&#13;
public static const AQUAMARINE : int = 0x7FFFD4;&#13;
public static const AZURE : int = 0xF0FFFF;&#13;
public static const BEIGE : int = 0xF5F5DC;&#13;
public static const BISQUE : int = 0xFFE4C4;&#13;
public static const BLANCHED_ALMOND : int = 0xFFEBCD;&#13;
public static const BLUE_VIOLET : int = 0x8A2BE2;&#13;
public static const BROWN : int = 0xA52A2A;&#13;
public static const BURLY_WOOD : int = 0xDEB887;&#13;
public static const CADET_BLUE : int = 0x5F9EA0;&#13;
public static const CHARTREUSE : int = 0x7FFF00;&#13;
public static const CHOCOLATE : int = 0xD2691E;&#13;
public static const CORAL : int = 0xFF7F50;&#13;
public static const CORNFLOWER_BLUE : int = 0x6495ED;&#13;
public static const CORNSILK : int = 0xFFF8DC;&#13;
public static const CRIMSON : int = 0xDC143C;&#13;
public static const CYAN : int = 0x00FFFF;&#13;
public static const DARK_BLUE : int = 0x00008B;&#13;
public static const DARK_CYAN : int = 0x008B8B;&#13;
public static const DARK_GOLDEN_ROD : int = 0xB8860B;&#13;
public static const DARK_GRAY : int = 0xA9A9A9;&#13;
public static const DARK_GREY : int = 0xA9A9A9;&#13;
public static const DARK_GREEN : int = 0x006400;&#13;
public static const DARK_KHAKI : int = 0xBDB76B;&#13;
public static const DARK_MAGENTA : int = 0x8B008B;&#13;
public static const DARK_OLIVE_GREEN : int = 0x556B2F;&#13;
public static const DARK_ORANGE : int = 0xFF8C00;&#13;
public static const DARK_ORCHID : int = 0x9932CC;&#13;
public static const DARK_RED : int = 0x8B0000;&#13;
public static const DARK_SALMON : int = 0xE9967A;&#13;
public static const DARK_SEA_GREEN : int = 0x8FBC8F;&#13;
public static const DARK_SLATE_BLUE : int = 0x483D8B;&#13;
public static const DARK_SLATE_GRAY : int = 0x2F4F4F;&#13;
public static const DARK_SLATE_GREY : int = 0x2F4F4F;&#13;
public static const DARK_TURQUOISE : int = 0x00CED1;&#13;
public static const DARK_VIOLET : int = 0x9400D3;&#13;
public static const DEEP_PINK : int = 0xFF1493;&#13;
public static const DEEP_SKY_BLUE : int = 0x00BFFF;&#13;
public static const DIM_GRAY : int = 0x696969;&#13;
public static const DIM_GREY : int = 0x696969;&#13;
public static const DODGER_BLUE : int = 0x1E90FF;&#13;
public static const FIRE_BRICK : int = 0xB22222;&#13;
public static const FLORAL_WHITE : int = 0xFFFAF0;&#13;
public static const FOREST_GREEN : int = 0x228B22;&#13;
public static const GAINSBORO : int = 0xDCDCDC;&#13;
public static const GHOST_WHITE : int = 0xF8F8FF;&#13;
public static const GOLD : int = 0xFFD700;&#13;
public static const GOLDEN_ROD : int = 0xDAA520;&#13;
public static const GREY : int = 0x808080;&#13;
public static const GREEN_YELLOW : int = 0xADFF2F;&#13;
public static const HONEY_DEW : int = 0xF0FFF0;&#13;
public static const HOT_PINK : int = 0xFF69B4;&#13;
public static const INDIAN_RED : int = 0xCD5C5C;&#13;
public static const INDIGO : int = 0x4B0082;&#13;
public static const IVORY : int = 0xFFFFF0;&#13;
public static const KHAKI : int = 0xF0E68C;&#13;
public static const LAVENDER : int = 0xE6E6FA;&#13;
public static const LAVENDER_BLUSH : int = 0xFFF0F5;&#13;
public static const LAWN_GREEN : int = 0x7CFC00;&#13;
public static const LEMON_CHIFFON : int = 0xFFFACD;&#13;
public static const LIGHT_BLUE : int = 0xADD8E6;&#13;
public static const LIGHT_CORAL : int = 0xF08080;&#13;
public static const LIGHT_CYAN : int = 0xE0FFFF;&#13;
public static const LIGHT_GOLDEN_ROD_YELLOW : int = 0xFAFAD2;&#13;
public static const LIGHT_GRAY : int = 0xD3D3D3;&#13;
public static const LIGHT_GREY : int = 0xD3D3D3;&#13;
public static const LIGHT_GREEN : int = 0x90EE90;&#13;
public static const LIGHT_PINK : int = 0xFFB6C1;&#13;
public static const LIGHT_SALMON : int = 0xFFA07A;&#13;
public static const LIGHT_SEA_GREEN : int = 0x20B2AA;&#13;
public static const LIGHT_SKY_BLUE : int = 0x87CEFA;&#13;
public static const LIGHT_SLATE_GRAY : int = 0x778899;&#13;
public static const LIGHT_SLATE_GREY : int = 0x778899;&#13;
public static const LIGHT_STEEL_BLUE : int = 0xB0C4DE;&#13;
public static const LIGHT_YELLOW : int = 0xFFFFE0;&#13;
public static const LIME_GREEN : int = 0x32CD32;&#13;
public static const LINEN : int = 0xFAF0E6;&#13;
public static const MAGENTA : int = 0xFF00FF;&#13;
public static const MEDIUM_AQUA_MARINE : int = 0x66CDAA;&#13;
public static const MEDIUM_BLUE : int = 0x0000CD;&#13;
public static const MEDIUM_ORCHID : int = 0xBA55D3;&#13;
public static const MEDIUM_PURPLE : int = 0x9370D8;&#13;
public static const MEDIUM_SEA_GREEN : int = 0x3CB371;&#13;
public static const MEDIUM_SLATE_BLUE : int = 0x7B68EE;&#13;
public static const MEDIUM_SPRING_GREEN : int = 0x00FA9A;&#13;
public static const MEDIUM_TURQUOISE : int = 0x48D1CC;&#13;
public static const MEDIUM_VIOLET_RED : int = 0xC71585;&#13;
public static const MIDNIGHT_BLUE : int = 0x191970;&#13;
public static const MINT_CREAM : int = 0xF5FFFA;&#13;
public static const MISTY_ROSE : int = 0xFFE4E1;&#13;
public static const MOCCASIN : int = 0xFFE4B5;&#13;
public static const NAVAJO_WHITE : int = 0xFFDEAD;&#13;
public static const OLD_LACE : int = 0xFDF5E6;&#13;
public static const OLIVE_DRAB : int = 0x6B8E23;&#13;
public static const ORANGE : int = 0xFFA500;&#13;
public static const ORANGE_RED : int = 0xFF4500;&#13;
public static const ORCHID : int = 0xDA70D6;&#13;
public static const PALE_GOLDEN_ROD : int = 0xEEE8AA;&#13;
public static const PALE_GREEN : int = 0x98FB98;&#13;
public static const PALE_TURQUOISE : int = 0xAFEEEE;&#13;
public static const PALE_VIOLET_RED : int = 0xD87093;&#13;
public static const PAPAYA_WHIP : int = 0xFFEFD5;&#13;
public static const PEACH_PUFF : int = 0xFFDAB9;&#13;
public static const PERU : int = 0xCD853F;&#13;
public static const PINK : int = 0xFFC0CB;&#13;
public static const PLUM : int = 0xDDA0DD;&#13;
public static const POWDER_BLUE : int = 0xB0E0E6;&#13;
public static const ROSY_BROWN : int = 0xBC8F8F;&#13;
public static const ROYAL_BLUE : int = 0x4169E1;&#13;
public static const SADDLE_BROWN : int = 0x8B4513;&#13;
public static const SALMON : int = 0xFA8072;&#13;
public static const SANDY_BROWN : int = 0xF4A460;&#13;
public static const SEA_GREEN : int = 0x2E8B57;&#13;
public static const SEA_SHELL : int = 0xFFF5EE;&#13;
public static const SIENNA : int = 0xA0522D;&#13;
public static const SKY_BLUE : int = 0x87CEEB;&#13;
public static const SLATE_BLUE : int = 0x6A5ACD;&#13;
public static const SLATE_GRAY : int = 0x708090;&#13;
public static const SLATE_GREY : int = 0x708090;&#13;
public static const SNOW : int = 0xFFFAFA;&#13;
public static const SPRING_GREEN : int = 0x00FF7F;&#13;
public static const STEEL_BLUE : int = 0x4682B4;&#13;
public static const TAN : int = 0xD2B48C;&#13;
public static const THISTLE : int = 0xD8BFD8;&#13;
public static const TOMATO : int = 0xFF6347;&#13;
public static const TURQUOISE : int = 0x40E0D0;&#13;
public static const VIOLET : int = 0xEE82EE;&#13;
public static const WHEAT : int = 0xF5DEB3;&#13;
public static const WHITE_SMOKE : int = 0xF5F5F5;&#13;
public static const YELLOW_GREEN : int = 0x9ACD32;&lt;/p&gt;</description>
      <pubDate>Wed, 19 Jan 2011 08:21:01 UTC</pubDate>
      <guid>https://snipplr.com/view/46082/as3-html-color-keywords-colorname-class</guid>
    </item>
    <item>
      <title>mgeduld said on 19/Jan/2011</title>
      <link>https://snipplr.com/view/46082/as3-html-color-keywords-colorname-class</link>
      <description>&lt;p&gt;Yikes! That didn't turn out well. I will make a new top-level post. Sorry.&lt;/p&gt;</description>
      <pubDate>Wed, 19 Jan 2011 08:21:40 UTC</pubDate>
      <guid>https://snipplr.com/view/46082/as3-html-color-keywords-colorname-class</guid>
    </item>
  </channel>
</rss>
