Return to Snippet

Revision: 39633
at January 19, 2011 08:25 by mgeduld


Initial Code
public static const NO_COLOR : int = -1;

//grays
public static const GRAY10: int = 0x1A1A1A;
public static const GRAY20: int = 0x333333;
public static const GRAY30: int = 0x4D4D4D;
public static const GRAY40: int = 0x666666;
public static const GRAY50: int = 0x808080;
public static const GRAY60: int = 0x999999;
public static const GRAY70: int = 0xB3B3B3;
public static const GRAY80: int = 0xCCCCCC;
public static const GRAY90: int = 0xE5E5E5;

//HTML4 COLOR KEYWORDS - VGA
//@see http://www.w3.org/TR/css3-color/#html4
public static const AQUA : int = 0x00FFFF;
public static const BLACK : int = 0x000000;
public static const BLUE : int = 0x0000FF;
public static const FUCHSIA : int = 0xFF00FF;
public static const GRAY : int = 0x808080;
public static const GREEN : int = 0x008000;
public static const LIME : int = 0x00FF00;
public static const MAROON : int = 0x800000;
public static const NAVY : int = 0x000080;
public static const OLIVE : int = 0x808000;
public static const PURPLE : int = 0x800080;
public static const RED : int = 0xFF0000;
public static const SILVER : int = 0xC0C0C0;
public static const TEAL : int = 0x008080;
public static const WHITE : int = 0xFFFFFF;
public static const YELLOW : int = 0xFFFF00;

//SVG COLOR KEYWORDS - X11 ( INCLUDES THE 16 HTML4 - VGA COLORS )
//@see http://www.w3.org/TR/css3-color/#svg-color
public static const ALICE_BLUE : int = 0xF0F8FF;
public static const ANTIQUE_WHITE : int = 0xFAEBD7;
public static const AQUAMARINE : int = 0x7FFFD4;
public static const AZURE : int = 0xF0FFFF;
public static const BEIGE : int = 0xF5F5DC;
public static const BISQUE : int = 0xFFE4C4;
public static const BLANCHED_ALMOND : int = 0xFFEBCD;
public static const BLUE_VIOLET : int = 0x8A2BE2;
public static const BROWN : int = 0xA52A2A;
public static const BURLY_WOOD : int = 0xDEB887;
public static const CADET_BLUE : int = 0x5F9EA0;
public static const CHARTREUSE : int = 0x7FFF00;
public static const CHOCOLATE : int = 0xD2691E;
public static const CORAL : int = 0xFF7F50;
public static const CORNFLOWER_BLUE : int = 0x6495ED;
public static const CORNSILK : int = 0xFFF8DC;
public static const CRIMSON : int = 0xDC143C;
public static const CYAN : int = 0x00FFFF;
public static const DARK_BLUE : int = 0x00008B;
public static const DARK_CYAN : int = 0x008B8B;
public static const DARK_GOLDEN_ROD : int = 0xB8860B;
public static const DARK_GRAY : int = 0xA9A9A9;
public static const DARK_GREY : int = 0xA9A9A9;
public static const DARK_GREEN : int = 0x006400;
public static const DARK_KHAKI : int = 0xBDB76B;
public static const DARK_MAGENTA : int = 0x8B008B;
public static const DARK_OLIVE_GREEN : int = 0x556B2F;
public static const DARK_ORANGE : int = 0xFF8C00;
public static const DARK_ORCHID : int = 0x9932CC;
public static const DARK_RED : int = 0x8B0000;
public static const DARK_SALMON : int = 0xE9967A;
public static const DARK_SEA_GREEN : int = 0x8FBC8F;
public static const DARK_SLATE_BLUE : int = 0x483D8B;
public static const DARK_SLATE_GRAY : int = 0x2F4F4F;
public static const DARK_SLATE_GREY : int = 0x2F4F4F;
public static const DARK_TURQUOISE : int = 0x00CED1;
public static const DARK_VIOLET : int = 0x9400D3;
public static const DEEP_PINK : int = 0xFF1493;
public static const DEEP_SKY_BLUE : int = 0x00BFFF;
public static const DIM_GRAY : int = 0x696969;
public static const DIM_GREY : int = 0x696969;
public static const DODGER_BLUE : int = 0x1E90FF;
public static const FIRE_BRICK : int = 0xB22222;
public static const FLORAL_WHITE : int = 0xFFFAF0;
public static const FOREST_GREEN : int = 0x228B22;
public static const GAINSBORO : int = 0xDCDCDC;
public static const GHOST_WHITE : int = 0xF8F8FF;
public static const GOLD : int = 0xFFD700;
public static const GOLDEN_ROD : int = 0xDAA520;
public static const GREY : int = 0x808080;
public static const GREEN_YELLOW : int = 0xADFF2F;
public static const HONEY_DEW : int = 0xF0FFF0;
public static const HOT_PINK : int = 0xFF69B4;
public static const INDIAN_RED : int = 0xCD5C5C;
public static const INDIGO : int = 0x4B0082;
public static const IVORY : int = 0xFFFFF0;
public static const KHAKI : int = 0xF0E68C;
public static const LAVENDER : int = 0xE6E6FA;
public static const LAVENDER_BLUSH : int = 0xFFF0F5;
public static const LAWN_GREEN : int = 0x7CFC00;
public static const LEMON_CHIFFON : int = 0xFFFACD;
public static const LIGHT_BLUE : int = 0xADD8E6;
public static const LIGHT_CORAL : int = 0xF08080;
public static const LIGHT_CYAN : int = 0xE0FFFF;
public static const LIGHT_GOLDEN_ROD_YELLOW : int = 0xFAFAD2;
public static const LIGHT_GRAY : int = 0xD3D3D3;
public static const LIGHT_GREY : int = 0xD3D3D3;
public static const LIGHT_GREEN : int = 0x90EE90;
public static const LIGHT_PINK : int = 0xFFB6C1;
public static const LIGHT_SALMON : int = 0xFFA07A;
public static const LIGHT_SEA_GREEN : int = 0x20B2AA;
public static const LIGHT_SKY_BLUE : int = 0x87CEFA;
public static const LIGHT_SLATE_GRAY : int = 0x778899;
public static const LIGHT_SLATE_GREY : int = 0x778899;
public static const LIGHT_STEEL_BLUE : int = 0xB0C4DE;
public static const LIGHT_YELLOW : int = 0xFFFFE0;
public static const LIME_GREEN : int = 0x32CD32;
public static const LINEN : int = 0xFAF0E6;
public static const MAGENTA : int = 0xFF00FF;
public static const MEDIUM_AQUA_MARINE : int = 0x66CDAA;
public static const MEDIUM_BLUE : int = 0x0000CD;
public static const MEDIUM_ORCHID : int = 0xBA55D3;
public static const MEDIUM_PURPLE : int = 0x9370D8;
public static const MEDIUM_SEA_GREEN : int = 0x3CB371;
public static const MEDIUM_SLATE_BLUE : int = 0x7B68EE;
public static const MEDIUM_SPRING_GREEN : int = 0x00FA9A;
public static const MEDIUM_TURQUOISE : int = 0x48D1CC;
public static const MEDIUM_VIOLET_RED : int = 0xC71585;
public static const MIDNIGHT_BLUE : int = 0x191970;
public static const MINT_CREAM : int = 0xF5FFFA;
public static const MISTY_ROSE : int = 0xFFE4E1;
public static const MOCCASIN : int = 0xFFE4B5;
public static const NAVAJO_WHITE : int = 0xFFDEAD;
public static const OLD_LACE : int = 0xFDF5E6;
public static const OLIVE_DRAB : int = 0x6B8E23;
public static const ORANGE : int = 0xFFA500;
public static const ORANGE_RED : int = 0xFF4500;
public static const ORCHID : int = 0xDA70D6;
public static const PALE_GOLDEN_ROD : int = 0xEEE8AA;
public static const PALE_GREEN : int = 0x98FB98;
public static const PALE_TURQUOISE : int = 0xAFEEEE;
public static const PALE_VIOLET_RED : int = 0xD87093;
public static const PAPAYA_WHIP : int = 0xFFEFD5;
public static const PEACH_PUFF : int = 0xFFDAB9;
public static const PERU : int = 0xCD853F;
public static const PINK : int = 0xFFC0CB;
public static const PLUM : int = 0xDDA0DD;
public static const POWDER_BLUE : int = 0xB0E0E6;
public static const ROSY_BROWN : int = 0xBC8F8F;
public static const ROYAL_BLUE : int = 0x4169E1;
public static const SADDLE_BROWN : int = 0x8B4513;
public static const SALMON : int = 0xFA8072;
public static const SANDY_BROWN : int = 0xF4A460;
public static const SEA_GREEN : int = 0x2E8B57;
public static const SEA_SHELL : int = 0xFFF5EE;
public static const SIENNA : int = 0xA0522D;
public static const SKY_BLUE : int = 0x87CEEB;
public static const SLATE_BLUE : int = 0x6A5ACD;
public static const SLATE_GRAY : int = 0x708090;
public static const SLATE_GREY : int = 0x708090;
public static const SNOW : int = 0xFFFAFA;
public static const SPRING_GREEN : int = 0x00FF7F;
public static const STEEL_BLUE : int = 0x4682B4;
public static const TAN : int = 0xD2B48C;
public static const THISTLE : int = 0xD8BFD8;
public static const TOMATO : int = 0xFF6347;
public static const TURQUOISE : int = 0x40E0D0;
public static const VIOLET : int = 0xEE82EE;
public static const WHEAT : int = 0xF5DEB3;
public static const WHITE_SMOKE : int = 0xF5F5F5;
public static const YELLOW_GREEN : int = 0x9ACD32;

Initial URL

                                

Initial Description
This is based on http://www.snipplr.com/view/46082/as3-html-color-keywords-colorname-class/

I found that link really useful, but it's more complex than I needed. I just wanted a simple list of consts. So I ran the above through a regexp and extracted the following code, adding the grays to it.

I also added the NO_COLOR const, which I sometimes find useful (and why I used ints intead of uints, which can't ever be negative). Color values are always positive numbers. There's no equivalent to null, because zero is a color (black). So NO_COLOR is my faux null.

Initial Title
Color Const: grays, html colors, svg colors

Initial Tags
html, color

Initial Language
ActionScript 3