1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint.mapcss;
|
---|
3 |
|
---|
4 | import java.awt.Color;
|
---|
5 | import java.util.HashMap;
|
---|
6 | import java.util.Map;
|
---|
7 |
|
---|
8 | public final class CSSColors {
|
---|
9 | private static final Map<String, Color> CSS_COLORS = new HashMap<>();
|
---|
10 | static {
|
---|
11 | for (Object[] pair : new Object[][] {
|
---|
12 | {"aliceblue", 0xf0f8ff},
|
---|
13 | {"antiquewhite", 0xfaebd7},
|
---|
14 | {"aqua", 0x00ffff},
|
---|
15 | {"aquamarine", 0x7fffd4},
|
---|
16 | {"azure", 0xf0ffff},
|
---|
17 | {"beige", 0xf5f5dc},
|
---|
18 | {"bisque", 0xffe4c4},
|
---|
19 | {"black", 0x000000},
|
---|
20 | {"blanchedalmond", 0xffebcd},
|
---|
21 | {"blue", 0x0000ff},
|
---|
22 | {"blueviolet", 0x8a2be2},
|
---|
23 | {"brown", 0xa52a2a},
|
---|
24 | {"burlywood", 0xdeb887},
|
---|
25 | {"cadetblue", 0x5f9ea0},
|
---|
26 | {"chartreuse", 0x7fff00},
|
---|
27 | {"chocolate", 0xd2691e},
|
---|
28 | {"coral", 0xff7f50},
|
---|
29 | {"cornflowerblue", 0x6495ed},
|
---|
30 | {"cornsilk", 0xfff8dc},
|
---|
31 | {"crimson", 0xdc143c},
|
---|
32 | {"cyan", 0x00ffff},
|
---|
33 | {"darkblue", 0x00008b},
|
---|
34 | {"darkcyan", 0x008b8b},
|
---|
35 | {"darkgoldenrod", 0xb8860b},
|
---|
36 | {"darkgray", 0xa9a9a9},
|
---|
37 | {"darkgreen", 0x006400},
|
---|
38 | {"darkgrey", 0xa9a9a9},
|
---|
39 | {"darkkhaki", 0xbdb76b},
|
---|
40 | {"darkmagenta", 0x8b008b},
|
---|
41 | {"darkolivegreen", 0x556b2f},
|
---|
42 | {"darkorange", 0xff8c00},
|
---|
43 | {"darkorchid", 0x9932cc},
|
---|
44 | {"darkred", 0x8b0000},
|
---|
45 | {"darksalmon", 0xe9967a},
|
---|
46 | {"darkseagreen", 0x8fbc8f},
|
---|
47 | {"darkslateblue", 0x483d8b},
|
---|
48 | {"darkslategray", 0x2f4f4f},
|
---|
49 | {"darkslategrey", 0x2f4f4f},
|
---|
50 | {"darkturquoise", 0x00ced1},
|
---|
51 | {"darkviolet", 0x9400d3},
|
---|
52 | {"deeppink", 0xff1493},
|
---|
53 | {"deepskyblue", 0x00bfff},
|
---|
54 | {"dimgray", 0x696969},
|
---|
55 | {"dimgrey", 0x696969},
|
---|
56 | {"dodgerblue", 0x1e90ff},
|
---|
57 | {"firebrick", 0xb22222},
|
---|
58 | {"floralwhite", 0xfffaf0},
|
---|
59 | {"forestgreen", 0x228b22},
|
---|
60 | {"fuchsia", 0xff00ff},
|
---|
61 | {"gainsboro", 0xdcdcdc},
|
---|
62 | {"ghostwhite", 0xf8f8ff},
|
---|
63 | {"gold", 0xffd700},
|
---|
64 | {"goldenrod", 0xdaa520},
|
---|
65 | {"gray", 0x808080},
|
---|
66 | {"green", 0x008000},
|
---|
67 | {"greenyellow", 0xadff2f},
|
---|
68 | {"grey", 0x808080},
|
---|
69 | {"honeydew", 0xf0fff0},
|
---|
70 | {"hotpink", 0xff69b4},
|
---|
71 | {"indianred", 0xcd5c5c},
|
---|
72 | {"indigo", 0x4b0082},
|
---|
73 | {"ivory", 0xfffff0},
|
---|
74 | {"khaki", 0xf0e68c},
|
---|
75 | {"lavender", 0xe6e6fa},
|
---|
76 | {"lavenderblush", 0xfff0f5},
|
---|
77 | {"lawngreen", 0x7cfc00},
|
---|
78 | {"lemonchiffon", 0xfffacd},
|
---|
79 | {"lightblue", 0xadd8e6},
|
---|
80 | {"lightcoral", 0xf08080},
|
---|
81 | {"lightcyan", 0xe0ffff},
|
---|
82 | {"lightgoldenrodyellow", 0xfafad2},
|
---|
83 | {"lightgray", 0xd3d3d3},
|
---|
84 | {"lightgreen", 0x90ee90},
|
---|
85 | {"lightgrey", 0xd3d3d3},
|
---|
86 | {"lightpink", 0xffb6c1},
|
---|
87 | {"lightsalmon", 0xffa07a},
|
---|
88 | {"lightseagreen", 0x20b2aa},
|
---|
89 | {"lightskyblue", 0x87cefa},
|
---|
90 | {"lightslategray", 0x778899},
|
---|
91 | {"lightslategrey", 0x778899},
|
---|
92 | {"lightsteelblue", 0xb0c4de},
|
---|
93 | {"lightyellow", 0xffffe0},
|
---|
94 | {"lime", 0x00ff00},
|
---|
95 | {"limegreen", 0x32cd32},
|
---|
96 | {"linen", 0xfaf0e6},
|
---|
97 | {"magenta", 0xff00ff},
|
---|
98 | {"maroon", 0x800000},
|
---|
99 | {"mediumaquamarine", 0x66cdaa},
|
---|
100 | {"mediumblue", 0x0000cd},
|
---|
101 | {"mediumorchid", 0xba55d3},
|
---|
102 | {"mediumpurple", 0x9370db},
|
---|
103 | {"mediumseagreen", 0x3cb371},
|
---|
104 | {"mediumslateblue", 0x7b68ee},
|
---|
105 | {"mediumspringgreen", 0x00fa9a},
|
---|
106 | {"mediumturquoise", 0x48d1cc},
|
---|
107 | {"mediumvioletred", 0xc71585},
|
---|
108 | {"midnightblue", 0x191970},
|
---|
109 | {"mintcream", 0xf5fffa},
|
---|
110 | {"mistyrose", 0xffe4e1},
|
---|
111 | {"moccasin", 0xffe4b5},
|
---|
112 | {"navajowhite", 0xffdead},
|
---|
113 | {"navy", 0x000080},
|
---|
114 | {"oldlace", 0xfdf5e6},
|
---|
115 | {"olive", 0x808000},
|
---|
116 | {"olivedrab", 0x6b8e23},
|
---|
117 | {"orange", 0xffa500},
|
---|
118 | {"orangered", 0xff4500},
|
---|
119 | {"orchid", 0xda70d6},
|
---|
120 | {"palegoldenrod", 0xeee8aa},
|
---|
121 | {"palegreen", 0x98fb98},
|
---|
122 | {"paleturquoise", 0xafeeee},
|
---|
123 | {"palevioletred", 0xdb7093},
|
---|
124 | {"papayawhip", 0xffefd5},
|
---|
125 | {"peachpuff", 0xffdab9},
|
---|
126 | {"peru", 0xcd853f},
|
---|
127 | {"pink", 0xffc0cb},
|
---|
128 | {"plum", 0xdda0dd},
|
---|
129 | {"powderblue", 0xb0e0e6},
|
---|
130 | {"purple", 0x800080},
|
---|
131 | {"red", 0xff0000},
|
---|
132 | {"rosybrown", 0xbc8f8f},
|
---|
133 | {"royalblue", 0x4169e1},
|
---|
134 | {"saddlebrown", 0x8b4513},
|
---|
135 | {"salmon", 0xfa8072},
|
---|
136 | {"sandybrown", 0xf4a460},
|
---|
137 | {"seagreen", 0x2e8b57},
|
---|
138 | {"seashell", 0xfff5ee},
|
---|
139 | {"sienna", 0xa0522d},
|
---|
140 | {"silver", 0xc0c0c0},
|
---|
141 | {"skyblue", 0x87ceeb},
|
---|
142 | {"slateblue", 0x6a5acd},
|
---|
143 | {"slategray", 0x708090},
|
---|
144 | {"slategrey", 0x708090},
|
---|
145 | {"snow", 0xfffafa},
|
---|
146 | {"springgreen", 0x00ff7f},
|
---|
147 | {"steelblue", 0x4682b4},
|
---|
148 | {"tan", 0xd2b48c},
|
---|
149 | {"teal", 0x008080},
|
---|
150 | {"thistle", 0xd8bfd8},
|
---|
151 | {"tomato", 0xff6347},
|
---|
152 | {"turquoise", 0x40e0d0},
|
---|
153 | {"violet", 0xee82ee},
|
---|
154 | {"wheat", 0xf5deb3},
|
---|
155 | {"white", 0xffffff},
|
---|
156 | {"whitesmoke", 0xf5f5f5},
|
---|
157 | {"yellow", 0xffff00},
|
---|
158 | {"yellowgreen", 0x9acd32}
|
---|
159 | }) {
|
---|
160 | CSS_COLORS.put((String) pair[0], new Color((Integer) pair[1]));
|
---|
161 | }
|
---|
162 | }
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Returns the CSS color for the given key
|
---|
166 | * @param key The key to find
|
---|
167 | * @return The color for {@code key}
|
---|
168 | */
|
---|
169 | public static Color get(String key) {
|
---|
170 | return CSS_COLORS.get(key);
|
---|
171 | }
|
---|
172 |
|
---|
173 | private CSSColors() {
|
---|
174 | // Hide default constructor for utils classes
|
---|
175 | }
|
---|
176 | }
|
---|