UIUtils.class.php (4307B)
1 <?php 2 3 4 namespace util; 5 6 7 class UIUtils 8 { 9 10 /** 11 * Translates a color name into its hexadecimal code. 12 * 13 * @param $colorName 14 * @return mixed|string 15 */ 16 public static function getColorHexCode($colorName ) { 17 18 $colorName = strtolower($colorName); 19 20 $colors = array( 21 'aliceblue'=>'#f0f8ff', 22 'antiquewhite'=>'#faebd7', 23 'aqua'=>'#00ffff', 24 'aquamarine'=>'#7fffd4', 25 'azure'=>'#f0ffff', 26 'beige'=>'#f5f5dc', 27 'bisque'=>'#ffe4c4', 28 'black'=>'#000000', 29 'blanchedalmond'=>'#ffebcd', 30 'blue'=>'#0000ff', 31 'blueviolet'=>'#8a2be2', 32 'brown'=>'#a52a2a', 33 'burlywood'=>'#deb887', 34 'cadetblue'=>'#5f9ea0', 35 'chartreuse'=>'#7fff00', 36 'chocolate'=>'#d2691e', 37 'coral'=>'#ff7f50', 38 'cornflowerblue'=>'#6495ed', 39 'cornsilk'=>'#fff8dc', 40 'crimson'=>'#dc143c', 41 'cyan'=>'#00ffff', 42 'darkblue'=>'#00008b', 43 'darkcyan'=>'#008b8b', 44 'darkgoldenrod'=>'#b8860b', 45 'darkgray'=>'#a9a9a9', 46 'darkgrey'=>'#a9a9a9', 47 'darkgreen'=>'#006400', 48 'darkkhaki'=>'#bdb76b', 49 'darkmagenta'=>'#8b008b', 50 'darkolivegreen'=>'#556b2f', 51 'darkorange'=>'#ff8c00', 52 'darkorchid'=>'#9932cc', 53 'darkred'=>'#8b0000', 54 'darksalmon'=>'#e9967a', 55 'darkseagreen'=>'#8fbc8f', 56 'darkslateblue'=>'#483d8b', 57 'darkslategray'=>'#2f4f4f', 58 'darkslategrey'=>'#2f4f4f', 59 'darkturquoise'=>'#00ced1', 60 'darkviolet'=>'#9400d3', 61 'deeppink'=>'#ff1493', 62 'deepskyblue'=>'#00bfff', 63 'dimgray'=>'#696969', 64 'dimgrey'=>'#696969', 65 'dodgerblue'=>'#1e90ff', 66 'firebrick'=>'#b22222', 67 'floralwhite'=>'#fffaf0', 68 'forestgreen'=>'#228b22', 69 'fuchsia'=>'#ff00ff', 70 'gainsboro'=>'#dcdcdc', 71 'ghostwhite'=>'#f8f8ff', 72 'gold'=>'#ffd700', 73 'goldenrod'=>'#daa520', 74 'gray'=>'#808080', 75 'grey'=>'#808080', 76 'green'=>'#008000', 77 'greenyellow'=>'#adff2f', 78 'honeydew'=>'#f0fff0', 79 'hotpink'=>'#ff69b4', 80 'indianred'=>'#cd5c5c', 81 'indigo'=>'#4b0082', 82 'ivory'=>'#fffff0', 83 'khaki'=>'#f0e68c', 84 'lavender'=>'#e6e6fa', 85 'lavenderblush'=>'#fff0f5', 86 'lawngreen'=>'#7cfc00', 87 'lemonchiffon'=>'#fffacd', 88 'lightblue'=>'#add8e6', 89 'lightcoral'=>'#f08080', 90 'lightcyan'=>'#e0ffff', 91 'lightgoldenrodyellow'=>'#fafad2', 92 'lightgray'=>'#d3d3d3', 93 'lightgrey'=>'#d3d3d3', 94 'lightgreen'=>'#90ee90', 95 'lightpink'=>'#ffb6c1', 96 'lightsalmon'=>'#ffa07a', 97 'lightseagreen'=>'#20b2aa', 98 'lightskyblue'=>'#87cefa', 99 'lightslategray'=>'#778899', 100 'lightslategrey'=>'#778899', 101 'lightsteelblue'=>'#b0c4de', 102 'lightyellow'=>'#ffffe0', 103 'lime'=>'#00ff00', 104 'limegreen'=>'#32cd32', 105 'linen'=>'#faf0e6', 106 'magenta'=>'#ff00ff', 107 'maroon'=>'#800000', 108 'mediumaquamarine'=>'#66cdaa', 109 'mediumblue'=>'#0000cd', 110 'mediumorchid'=>'#ba55d3', 111 'mediumpurple'=>'#9370d8', 112 'mediumseagreen'=>'#3cb371', 113 'mediumslateblue'=>'#7b68ee', 114 'mediumspringgreen'=>'#00fa9a', 115 'mediumturquoise'=>'#48d1cc', 116 'mediumvioletred'=>'#c71585', 117 'midnightblue'=>'#191970', 118 'mintcream'=>'#f5fffa', 119 'mistyrose'=>'#ffe4e1', 120 'moccasin'=>'#ffe4b5', 121 'navajowhite'=>'#ffdead', 122 'navy'=>'#000080', 123 'oldlace'=>'#fdf5e6', 124 'olive'=>'#808000', 125 'olivedrab'=>'#6b8e23', 126 'orange'=>'#ffa500', 127 'orangered'=>'#ff4500', 128 'orchid'=>'#da70d6', 129 'palegoldenrod'=>'#eee8aa', 130 'palegreen'=>'#98fb98', 131 'paleturquoise'=>'#afeeee', 132 'palevioletred'=>'#d87093', 133 'papayawhip'=>'#ffefd5', 134 'peachpuff'=>'#ffdab9', 135 'peru'=>'#cd853f', 136 'pink'=>'#ffc0cb', 137 'plum'=>'#dda0dd', 138 'powderblue'=>'#b0e0e6', 139 'purple'=>'#800080', 140 'red'=>'#ff0000', 141 'rosybrown'=>'#bc8f8f', 142 'royalblue'=>'#4169e1', 143 'saddlebrown'=>'#8b4513', 144 'salmon'=>'#fa8072', 145 'sandybrown'=>'#f4a460', 146 'seagreen'=>'#2e8b57', 147 'seashell'=>'#fff5ee', 148 'sienna'=>'#a0522d', 149 'silver'=>'#c0c0c0', 150 'skyblue'=>'#87ceeb', 151 'slateblue'=>'#6a5acd', 152 'slategray'=>'#708090', 153 'slategrey'=>'#708090', 154 'snow'=>'#fffafa', 155 'springgreen'=>'#00ff7f', 156 'steelblue'=>'#4682b4', 157 'tan'=>'#d2b48c', 158 'teal'=>'#008080', 159 'thistle'=>'#d8bfd8', 160 'tomato'=>'#ff6347', 161 'turquoise'=>'#40e0d0', 162 'violet'=>'#ee82ee', 163 'wheat'=>'#f5deb3', 164 'white'=>'#ffffff', 165 'whitesmoke'=>'#f5f5f5', 166 'yellow'=>'#ffff00', 167 'yellowgreen'=>'#9acd32' 168 ); 169 170 return isset($colors[$colorName])?$colors[$colorName]:$colorName; 171 } 172 173 }