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