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