http://outofmemory.cn/code-snippet/1960/php-color-define-table
1 <? 2 //////////////////////////////////////////////////////// 3 // 4 // colors.php - 这个程序只是定义了一些颜色的名字。 5 // 6 // Author: Claus Radloff 7 // 8 // 描述:定义了一个颜色名字的联合数组。每个实体是由一个颜 9 // 色的名字和其RGB的参数所组成。函数GetColor 用颜色名做 10 // 参数,并且返回一个由RGB颜色所组成的联合数组。 11 // 12 // 4/14/2000 Mouse Chen( litmouse@km169.net ) Translate it to Chinese 13 14 $Colors = array( 15 16 // HTML 3.规范中所定义的颜色 17 "black"=>array( "red"=>0x00, "green"=>0x00, "blue"=>0x00), 18 "maroon"=>array( "red"=>0x80, "green"=>0x00, "blue"=>0x00), 19 "green"=>array( "red"=>0x00, "green"=>0x80, "blue"=>0x00), 20 "olive"=>array( "red"=>0x80, "green"=>0x80, "blue"=>0x00), 21 "navy"=>array( "red"=>0x00, "green"=>0x00, "blue"=>0x80), 22 "purple"=>array( "red"=>0x80, "green"=>0x00, "blue"=>0x80), 23 "teal"=>array( "red"=>0x00, "green"=>0x80, "blue"=>0x80), 24 "gray"=>array( "red"=>0x80, "green"=>0x80, "blue"=>0x80), 25 "silver"=>array( "red"=>0xC0, "green"=>0xC0, "blue"=>0xC0), 26 "red"=>array( "red"=>0xFF, "green"=>0x00, "blue"=>0x00), 27 "lime"=>array( "red"=>0x00, "green"=>0xFF, "blue"=>0x00), 28 "yellow"=>array( "red"=>0xFF, "green"=>0xFF, "blue"=>0x00), 29 "blue"=>array( "red"=>0x00, "green"=>0x00, "blue"=>0xFF), 30 "fuchsia"=>array( "red"=>0xFF, "green"=>0x00, "blue"=>0xFF), 31 "aqua"=>array( "red"=>0x00, "green"=>0xFF, "blue"=>0xFF), 32 "white"=>array( "red"=>0xFF, "green"=>0xFF, "blue"=>0xFF), 33 34 // Netscape and IE所附加定义的颜色 35 "aliceblue"=>array( "red"=>0xF0, "green"=>0xF8, "blue"=>0xFF), 36 "antiquewhite"=>array( "red"=>0xFA, "green"=>0xEB, "blue"=>0xD7), 37 "aquamarine"=>array( "red"=>0x7F, "green"=>0xFF, "blue"=>0xD4), 38 "azure"=>array( "red"=>0xF0, "green"=>0xFF, "blue"=>0xFF), 39 "beige"=>array( "red"=>0xF5, "green"=>0xF5, "blue"=>0xDC), 40 "blueviolet"=>array( "red"=>0x8A, "green"=>0x2B, "blue"=>0xE2), 41 "brown"=>array( "red"=>0xA5, "green"=>0x2A, "blue"=>0x2A), 42 "burlywood"=>array( "red"=>0xDE, "green"=>0xB8, "blue"=>0x87), 43 "cadetblue"=>array( "red"=>0x5F, "green"=>0x9E, "blue"=>0xA0), 44 "chartreuse"=>array( "red"=>0x7F, "green"=>0xFF, "blue"=>0x00), 45 "chocolate"=>array( "red"=>0xD2, "green"=>0x69, "blue"=>0x1E), 46 "coral"=>array( "red"=>0xFF, "green"=>0x7F, "blue"=>0x50), 47 "cornflowerblue"=>array( "red"=>0x64, "green"=>0x95, "blue"=>0xED), 48 "cornsilk"=>array( "red"=>0xFF, "green"=>0xF8, "blue"=>0xDC), 49 "crimson"=>array( "red"=>0xDC, "green"=>0x14, "blue"=>0x3C), 50 "darkblue"=>array( "red"=>0x00, "green"=>0x00, "blue"=>0x8B), 51 "darkcyan"=>array( "red"=>0x00, "green"=>0x8B, "blue"=>0x8B), 52 "darkgoldenrod"=>array( "red"=>0xB8, "green"=>0x86, "blue"=>0x0B), 53 "darkgray"=>array( "red"=>0xA9, "green"=>0xA9, "blue"=>0xA9), 54 "darkgreen"=>array( "red"=>0x00, "green"=>0x64, "blue"=>0x00), 55 "darkkhaki"=>array( "red"=>0xBD, "green"=>0xB7, "blue"=>0x6B), 56 "darkmagenta"=>array( "red"=>0x8B, "green"=>0x00, "blue"=>0x8B), 57 "darkolivegreen"=>array( "red"=>0x55, "green"=>0x6B, "blue"=>0x2F), 58 "darkorange"=>array( "red"=>0xFF, "green"=>0x8C, "blue"=>0x00), 59 "darkorchid"=>array( "red"=>0x99, "green"=>0x32, "blue"=>0xCC), 60 "darkred"=>array( "red"=>0x8B, "green"=>0x00, "blue"=>0x00), 61 "darksalmon"=>array( "red"=>0xE9, "green"=>0x96, "blue"=>0x7A), 62 "darkseagreen"=>array( "red"=>0x8F, "green"=>0xBC, "blue"=>0x8F), 63 "darkslateblue"=>array( "red"=>0x48, "green"=>0x3D, "blue"=>0x8B), 64 "darkslategray"=>array( "red"=>0x2F, "green"=>0x4F, "blue"=>0x4F), 65 "darkturquoise"=>array( "red"=>0x00, "green"=>0xCE, "blue"=>0xD1), 66 "darkviolet"=>array( "red"=>0x94, "green"=>0x00, "blue"=>0xD3), 67 "deeppink"=>array( "red"=>0xFF, "green"=>0x14, "blue"=>0x93), 68 "deepskyblue"=>array( "red"=>0x00, "green"=>0xBF, "blue"=>0xFF), 69 "dimgray"=>array( "red"=>0x69, "green"=>0x69, "blue"=>0x69), 70 "dodgerblue"=>array( "red"=>0x1E, "green"=>0x90, "blue"=>0xFF), 71 "firebrick"=>array( "red"=>0xB2, "green"=>0x22, "blue"=>0x22), 72 "floralwhite"=>array( "red"=>0xFF, "green"=>0xFA, "blue"=>0xF0), 73 "forestgreen"=>array( "red"=>0x22, "green"=>0x8B, "blue"=>0x22), 74 "gainsboro"=>array( "red"=>0xDC, "green"=>0xDC, "blue"=>0xDC), 75 "ghostwhite"=>array( "red"=>0xF8, "green"=>0xF8, "blue"=>0xFF), 76 "gold"=>array( "red"=>0xFF, "green"=>0xD7, "blue"=>0x00), 77 "goldenrod"=>array( "red"=>0xDA, "green"=>0xA5, "blue"=>0x20), 78 "greenyellow"=>array( "red"=>0xAD, "green"=>0xFF, "blue"=>0x2F), 79 "honeydew"=>array( "red"=>0xF0, "green"=>0xFF, "blue"=>0xF0), 80 "hotpink"=>array( "red"=>0xFF, "green"=>0x69, "blue"=>0xB4), 81 "indianred"=>array( "red"=>0xCD, "green"=>0x5C, "blue"=>0x5C), 82 "indigo"=>array( "red"=>0x4B, "green"=>0x00, "blue"=>0x82), 83 "ivory"=>array( "red"=>0xFF, "green"=>0xFF, "blue"=>0xF0), 84 "khaki"=>array( "red"=>0xF0, "green"=>0xE6, "blue"=>0x8C), 85 "lavender"=>array( "red"=>0xE6, "green"=>0xE6, "blue"=>0xFA), 86 "lavenderblush"=>array( "red"=>0xFF, "green"=>0xF0, "blue"=>0xF5), 87 "lawngreen"=>array( "red"=>0x7C, "green"=>0xFC, "blue"=>0x00), 88 "lemonchiffon"=>array( "red"=>0xFF, "green"=>0xFA, "blue"=>0xCD), 89 "lightblue"=>array( "red"=>0xAD, "green"=>0xD8, "blue"=>0xE6), 90 "lightcoral"=>array( "red"=>0xF0, "green"=>0x80, "blue"=>0x80), 91 "lightcyan"=>array( "red"=>0xE0, "green"=>0xFF, "blue"=>0xFF), 92 "lightgoldenrodyellow"=>array( "red"=>0xFA, "green"=>0xFA, "blue"=>0xD2), 93 "lightgreen"=>array( "red"=>0x90, "green"=>0xEE, "blue"=>0x90), 94 "lightgrey"=>array( "red"=>0xD3, "green"=>0xD3, "blue"=>0xD3), 95 "lightpink"=>array( "red"=>0xFF, "green"=>0xB6, "blue"=>0xC1), 96 "lightsalmon"=>array( "red"=>0xFF, "green"=>0xA0, "blue"=>0x7A), 97 "lightseagreen"=>array( "red"=>0x20, "green"=>0xB2, "blue"=>0xAA), 98 "lightskyblue"=>array( "red"=>0x87, "green"=>0xCE, "blue"=>0xFA), 99 "lightslategray"=>array( "red"=>0x77, "green"=>0x88, "blue"=>0x99), 100 "lightsteelblue"=>array( "red"=>0xB0, "green"=>0xC4, "blue"=>0xDE), 101 "lightyellow"=>array( "red"=>0xFF, "green"=>0xFF, "blue"=>0xE0), 102 "limegreen"=>array( "red"=>0x32, "green"=>0xCD, "blue"=>0x32), 103 "linen"=>array( "red"=>0xFA, "green"=>0xF0, "blue"=>0xE6), 104 "mediumaquamarine"=>array( "red"=>0x66, "green"=>0xCD, "blue"=>0xAA), 105 "mediumblue"=>array( "red"=>0x00, "green"=>0x00, "blue"=>0xCD), 106 "mediumorchid"=>array( "red"=>0xBA, "green"=>0x55, "blue"=>0xD3), 107 "mediumpurple"=>array( "red"=>0x93, "green"=>0x70, "blue"=>0xD0), 108 "mediumseagreen"=>array( "red"=>0x3C, "green"=>0xB3, "blue"=>0x71), 109 "mediumslateblue"=>array( "red"=>0x7B, "green"=>0x68, "blue"=>0xEE), 110 "mediumspringgreen"=>array( "red"=>0x00, "green"=>0xFA, "blue"=>0x9A), 111 "mediumturquoise"=>array( "red"=>0x48, "green"=>0xD1, "blue"=>0xCC), 112 "mediumvioletred"=>array( "red"=>0xC7, "green"=>0x15, "blue"=>0x85), 113 "midnightblue"=>array( "red"=>0x19, "green"=>0x19, "blue"=>0x70), 114 "mintcream"=>array( "red"=>0xF5, "green"=>0xFF, "blue"=>0xFA), 115 "mistyrose"=>array( "red"=>0xFF, "green"=>0xE4, "blue"=>0xE1), 116 "moccasin"=>array( "red"=>0xFF, "green"=>0xE4, "blue"=>0xB5), 117 "navajowhite"=>array( "red"=>0xFF, "green"=>0xDE, "blue"=>0xAD), 118 "oldlace"=>array( "red"=>0xFD, "green"=>0xF5, "blue"=>0xE6), 119 "olivedrab"=>array( "red"=>0x6B, "green"=>0x8E, "blue"=>0x23), 120 "orange"=>array( "red"=>0xFF, "green"=>0xA5, "blue"=>0x00), 121 "orangered"=>array( "red"=>0xFF, "green"=>0x45, "blue"=>0x00), 122 "orchid"=>array( "red"=>0xDA, "green"=>0x70, "blue"=>0xD6), 123 "palegoldenrod"=>array( "red"=>0xEE, "green"=>0xE8, "blue"=>0xAA), 124 "palegreen"=>array( "red"=>0x98, "green"=>0xFB, "blue"=>0x98), 125 "paleturquoise"=>array( "red"=>0xAF, "green"=>0xEE, "blue"=>0xEE), 126 "palevioletred"=>array( "red"=>0xDB, "green"=>0x70, "blue"=>0x93), 127 "papayawhip"=>array( "red"=>0xFF, "green"=>0xEF, "blue"=>0xD5), 128 "peachpuff"=>array( "red"=>0xFF, "green"=>0xDA, "blue"=>0xB9), 129 "peru"=>array( "red"=>0xCD, "green"=>0x85, "blue"=>0x3F), 130 "pink"=>array( "red"=>0xFF, "green"=>0xC0, "blue"=>0xCB), 131 "plum"=>array( "red"=>0xDD, "green"=>0xA0, "blue"=>0xDD), 132 "powderblue"=>array( "red"=>0xB0, "green"=>0xE0, "blue"=>0xE6), 133 "rosybrown"=>array( "red"=>0xBC, "green"=>0x8F, "blue"=>0x8F), 134 "royalblue"=>array( "red"=>0x41, "green"=>0x69, "blue"=>0xE1), 135 "saddlebrown"=>array( "red"=>0x8B, "green"=>0x45, "blue"=>0x13), 136 "salmon"=>array( "red"=>0xFA, "green"=>0x80, "blue"=>0x72), 137 "sandybrown"=>array( "red"=>0xF4, "green"=>0xA4, "blue"=>0x60), 138 "seagreen"=>array( "red"=>0x2E, "green"=>0x8B, "blue"=>0x57), 139 "seashell"=>array( "red"=>0xFF, "green"=>0xF5, "blue"=>0xEE), 140 "sienna"=>array( "red"=>0xA0, "green"=>0x52, "blue"=>0x2D), 141 "skyblue"=>array( "red"=>0x87, "green"=>0xCE, "blue"=>0xEB), 142 "slateblue"=>array( "red"=>0x6A, "green"=>0x5A, "blue"=>0xCD), 143 "slategray"=>array( "red"=>0x70, "green"=>0x80, "blue"=>0x90), 144 "snow"=>array( "red"=>0xFF, "green"=>0xFA, "blue"=>0xFA), 145 "springgreen"=>array( "red"=>0x00, "green"=>0xFF, "blue"=>0x7F), 146 "steelblue"=>array( "red"=>0x46, "green"=>0x82, "blue"=>0xB4), 147 "tan"=>array( "red"=>0xD2, "green"=>0xB4, "blue"=>0x8C), 148 "thistle"=>array( "red"=>0xD8, "green"=>0xBF, "blue"=>0xD8), 149 "tomato"=>array( "red"=>0xFF, "green"=>0x63, "blue"=>0x47), 150 "turquoise"=>array( "red"=>0x40, "green"=>0xE0, "blue"=>0xD0), 151 "violet"=>array( "red"=>0xEE, "green"=>0x82, "blue"=>0xEE), 152 "wheat"=>array( "red"=>0xF5, "green"=>0xDE, "blue"=>0xB3), 153 "whitesmoke"=>array( "red"=>0xF5, "green"=>0xF5, "blue"=>0xF5), 154 "yellowgreen"=>array( "red"=>0x9A, "green"=>0xCD, "blue"=>0x32)); 155 156 // GetColor函数返回一个有关RGB三原色的联合数组 157 function GetColor($Colorname) 158 { 159 global $Colors; 160 return $Colors[$Colorname]; 161 } 162 ?>