Posted By

mgeduld on 01/19/11


Tagged

html color colors svg const consts


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

kure69


Color Const: grays, html colors, svg colors


 / Published in: ActionScript 3
 

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 NOCOLOR 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 NOCOLOR is my faux null.

  1. public static const NO_COLOR : int = -1;
  2.  
  3. //grays
  4. public static const GRAY10: int = 0x1A1A1A;
  5. public static const GRAY20: int = 0x333333;
  6. public static const GRAY30: int = 0x4D4D4D;
  7. public static const GRAY40: int = 0x666666;
  8. public static const GRAY50: int = 0x808080;
  9. public static const GRAY60: int = 0x999999;
  10. public static const GRAY70: int = 0xB3B3B3;
  11. public static const GRAY80: int = 0xCCCCCC;
  12. public static const GRAY90: int = 0xE5E5E5;
  13.  
  14. //HTML4 COLOR KEYWORDS - VGA
  15. //@see http://www.w3.org/TR/css3-color/#html4
  16. public static const AQUA : int = 0x00FFFF;
  17. public static const BLACK : int = 0x000000;
  18. public static const BLUE : int = 0x0000FF;
  19. public static const FUCHSIA : int = 0xFF00FF;
  20. public static const GRAY : int = 0x808080;
  21. public static const GREEN : int = 0x008000;
  22. public static const LIME : int = 0x00FF00;
  23. public static const MAROON : int = 0x800000;
  24. public static const NAVY : int = 0x000080;
  25. public static const OLIVE : int = 0x808000;
  26. public static const PURPLE : int = 0x800080;
  27. public static const RED : int = 0xFF0000;
  28. public static const SILVER : int = 0xC0C0C0;
  29. public static const TEAL : int = 0x008080;
  30. public static const WHITE : int = 0xFFFFFF;
  31. public static const YELLOW : int = 0xFFFF00;
  32.  
  33. //SVG COLOR KEYWORDS - X11 ( INCLUDES THE 16 HTML4 - VGA COLORS )
  34. //@see http://www.w3.org/TR/css3-color/#svg-color
  35. public static const ALICE_BLUE : int = 0xF0F8FF;
  36. public static const ANTIQUE_WHITE : int = 0xFAEBD7;
  37. public static const AQUAMARINE : int = 0x7FFFD4;
  38. public static const AZURE : int = 0xF0FFFF;
  39. public static const BEIGE : int = 0xF5F5DC;
  40. public static const BISQUE : int = 0xFFE4C4;
  41. public static const BLANCHED_ALMOND : int = 0xFFEBCD;
  42. public static const BLUE_VIOLET : int = 0x8A2BE2;
  43. public static const BROWN : int = 0xA52A2A;
  44. public static const BURLY_WOOD : int = 0xDEB887;
  45. public static const CADET_BLUE : int = 0x5F9EA0;
  46. public static const CHARTREUSE : int = 0x7FFF00;
  47. public static const CHOCOLATE : int = 0xD2691E;
  48. public static const CORAL : int = 0xFF7F50;
  49. public static const CORNFLOWER_BLUE : int = 0x6495ED;
  50. public static const CORNSILK : int = 0xFFF8DC;
  51. public static const CRIMSON : int = 0xDC143C;
  52. public static const CYAN : int = 0x00FFFF;
  53. public static const DARK_BLUE : int = 0x00008B;
  54. public static const DARK_CYAN : int = 0x008B8B;
  55. public static const DARK_GOLDEN_ROD : int = 0xB8860B;
  56. public static const DARK_GRAY : int = 0xA9A9A9;
  57. public static const DARK_GREY : int = 0xA9A9A9;
  58. public static const DARK_GREEN : int = 0x006400;
  59. public static const DARK_KHAKI : int = 0xBDB76B;
  60. public static const DARK_MAGENTA : int = 0x8B008B;
  61. public static const DARK_OLIVE_GREEN : int = 0x556B2F;
  62. public static const DARK_ORANGE : int = 0xFF8C00;
  63. public static const DARK_ORCHID : int = 0x9932CC;
  64. public static const DARK_RED : int = 0x8B0000;
  65. public static const DARK_SALMON : int = 0xE9967A;
  66. public static const DARK_SEA_GREEN : int = 0x8FBC8F;
  67. public static const DARK_SLATE_BLUE : int = 0x483D8B;
  68. public static const DARK_SLATE_GRAY : int = 0x2F4F4F;
  69. public static const DARK_SLATE_GREY : int = 0x2F4F4F;
  70. public static const DARK_TURQUOISE : int = 0x00CED1;
  71. public static const DARK_VIOLET : int = 0x9400D3;
  72. public static const DEEP_PINK : int = 0xFF1493;
  73. public static const DEEP_SKY_BLUE : int = 0x00BFFF;
  74. public static const DIM_GRAY : int = 0x696969;
  75. public static const DIM_GREY : int = 0x696969;
  76. public static const DODGER_BLUE : int = 0x1E90FF;
  77. public static const FIRE_BRICK : int = 0xB22222;
  78. public static const FLORAL_WHITE : int = 0xFFFAF0;
  79. public static const FOREST_GREEN : int = 0x228B22;
  80. public static const GAINSBORO : int = 0xDCDCDC;
  81. public static const GHOST_WHITE : int = 0xF8F8FF;
  82. public static const GOLD : int = 0xFFD700;
  83. public static const GOLDEN_ROD : int = 0xDAA520;
  84. public static const GREY : int = 0x808080;
  85. public static const GREEN_YELLOW : int = 0xADFF2F;
  86. public static const HONEY_DEW : int = 0xF0FFF0;
  87. public static const HOT_PINK : int = 0xFF69B4;
  88. public static const INDIAN_RED : int = 0xCD5C5C;
  89. public static const INDIGO : int = 0x4B0082;
  90. public static const IVORY : int = 0xFFFFF0;
  91. public static const KHAKI : int = 0xF0E68C;
  92. public static const LAVENDER : int = 0xE6E6FA;
  93. public static const LAVENDER_BLUSH : int = 0xFFF0F5;
  94. public static const LAWN_GREEN : int = 0x7CFC00;
  95. public static const LEMON_CHIFFON : int = 0xFFFACD;
  96. public static const LIGHT_BLUE : int = 0xADD8E6;
  97. public static const LIGHT_CORAL : int = 0xF08080;
  98. public static const LIGHT_CYAN : int = 0xE0FFFF;
  99. public static const LIGHT_GOLDEN_ROD_YELLOW : int = 0xFAFAD2;
  100. public static const LIGHT_GRAY : int = 0xD3D3D3;
  101. public static const LIGHT_GREY : int = 0xD3D3D3;
  102. public static const LIGHT_GREEN : int = 0x90EE90;
  103. public static const LIGHT_PINK : int = 0xFFB6C1;
  104. public static const LIGHT_SALMON : int = 0xFFA07A;
  105. public static const LIGHT_SEA_GREEN : int = 0x20B2AA;
  106. public static const LIGHT_SKY_BLUE : int = 0x87CEFA;
  107. public static const LIGHT_SLATE_GRAY : int = 0x778899;
  108. public static const LIGHT_SLATE_GREY : int = 0x778899;
  109. public static const LIGHT_STEEL_BLUE : int = 0xB0C4DE;
  110. public static const LIGHT_YELLOW : int = 0xFFFFE0;
  111. public static const LIME_GREEN : int = 0x32CD32;
  112. public static const LINEN : int = 0xFAF0E6;
  113. public static const MAGENTA : int = 0xFF00FF;
  114. public static const MEDIUM_AQUA_MARINE : int = 0x66CDAA;
  115. public static const MEDIUM_BLUE : int = 0x0000CD;
  116. public static const MEDIUM_ORCHID : int = 0xBA55D3;
  117. public static const MEDIUM_PURPLE : int = 0x9370D8;
  118. public static const MEDIUM_SEA_GREEN : int = 0x3CB371;
  119. public static const MEDIUM_SLATE_BLUE : int = 0x7B68EE;
  120. public static const MEDIUM_SPRING_GREEN : int = 0x00FA9A;
  121. public static const MEDIUM_TURQUOISE : int = 0x48D1CC;
  122. public static const MEDIUM_VIOLET_RED : int = 0xC71585;
  123. public static const MIDNIGHT_BLUE : int = 0x191970;
  124. public static const MINT_CREAM : int = 0xF5FFFA;
  125. public static const MISTY_ROSE : int = 0xFFE4E1;
  126. public static const MOCCASIN : int = 0xFFE4B5;
  127. public static const NAVAJO_WHITE : int = 0xFFDEAD;
  128. public static const OLD_LACE : int = 0xFDF5E6;
  129. public static const OLIVE_DRAB : int = 0x6B8E23;
  130. public static const ORANGE : int = 0xFFA500;
  131. public static const ORANGE_RED : int = 0xFF4500;
  132. public static const ORCHID : int = 0xDA70D6;
  133. public static const PALE_GOLDEN_ROD : int = 0xEEE8AA;
  134. public static const PALE_GREEN : int = 0x98FB98;
  135. public static const PALE_TURQUOISE : int = 0xAFEEEE;
  136. public static const PALE_VIOLET_RED : int = 0xD87093;
  137. public static const PAPAYA_WHIP : int = 0xFFEFD5;
  138. public static const PEACH_PUFF : int = 0xFFDAB9;
  139. public static const PERU : int = 0xCD853F;
  140. public static const PINK : int = 0xFFC0CB;
  141. public static const PLUM : int = 0xDDA0DD;
  142. public static const POWDER_BLUE : int = 0xB0E0E6;
  143. public static const ROSY_BROWN : int = 0xBC8F8F;
  144. public static const ROYAL_BLUE : int = 0x4169E1;
  145. public static const SADDLE_BROWN : int = 0x8B4513;
  146. public static const SALMON : int = 0xFA8072;
  147. public static const SANDY_BROWN : int = 0xF4A460;
  148. public static const SEA_GREEN : int = 0x2E8B57;
  149. public static const SEA_SHELL : int = 0xFFF5EE;
  150. public static const SIENNA : int = 0xA0522D;
  151. public static const SKY_BLUE : int = 0x87CEEB;
  152. public static const SLATE_BLUE : int = 0x6A5ACD;
  153. public static const SLATE_GRAY : int = 0x708090;
  154. public static const SLATE_GREY : int = 0x708090;
  155. public static const SNOW : int = 0xFFFAFA;
  156. public static const SPRING_GREEN : int = 0x00FF7F;
  157. public static const STEEL_BLUE : int = 0x4682B4;
  158. public static const TAN : int = 0xD2B48C;
  159. public static const THISTLE : int = 0xD8BFD8;
  160. public static const TOMATO : int = 0xFF6347;
  161. public static const TURQUOISE : int = 0x40E0D0;
  162. public static const VIOLET : int = 0xEE82EE;
  163. public static const WHEAT : int = 0xF5DEB3;
  164. public static const WHITE_SMOKE : int = 0xF5F5F5;
  165. public static const YELLOW_GREEN : int = 0x9ACD32;

Report this snippet  

You need to login to post a comment.