source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/CSSColors.java@ 16184

Last change on this file since 16184 was 12259, checked in by bastiK, 7 years ago

see #14794 - javadoc

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