1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.vectomatic.dom.svg.impl;
19
20 import java.util.ArrayList;
21 import java.util.HashMap;
22 import java.util.List;
23 import java.util.Map;
24
25 import org.vectomatic.dom.svg.OMRGBColor;
26 import org.vectomatic.dom.svg.OMSVGICCColor;
27 import org.vectomatic.dom.svg.OMSVGPaint;
28 import org.vectomatic.dom.svg.utils.SVGConstants;
29
30 import com.google.gwt.core.client.JavaScriptException;
31 import com.google.gwt.regexp.shared.MatchResult;
32 import com.google.gwt.regexp.shared.RegExp;
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 public class SVGPaintParser {
61 public static final OMSVGPaint NONE = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_NONE);
62 public static final OMSVGPaint INHERIT = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_UNKNOWN);
63 public static final OMSVGPaint CURRENT_COLOR = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_CURRENTCOLOR);
64 private static Map<String, String> nameToColor;
65 private static final String I255 = "25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]";
66 private static final String I100 = "[0-9]|[1-9][0-9]?|100";
67 private static final String WS = "\\s*";
68 private static final String COMMA = WS + "," + WS;
69 private static final String HEX = "[0-9a-fA-F]";
70 private static final String INT = "(?:[1-9][0-9]*|[0-9])";
71 private static final String PROFILE = "[^,\\(\\)\\s]+";
72 private static final String INTLIST = "(?:" + COMMA + INT + ")*";
73 private static final RegExp RGB255 = RegExp.compile("^rgb\\(" + WS + "(" + I255 + ")" + COMMA + "(" + I255 + ")" + COMMA + "(" + I255 + ")" + WS + "\\)\\s*", "g");
74 private static final RegExp RGBPCT = RegExp.compile("^rgb\\(" + WS + "(" + I100 + ")%" + COMMA + "(" + I100 + ")%" + COMMA + "(" + I100 + ")%" + WS + "\\)\\s*", "g");
75 private static final RegExp RGBHEX = RegExp.compile("^#(" + HEX + "{6}|" + HEX + "{3})\\s*", "g");
76 private static final RegExp FUNCIRI = RegExp.compile("^url\\(['\"]?([^\\)'\"]*)['\"]?\\)\\s*", "g");
77 private static final RegExp COLORNAME = RegExp.compile("^([a-z]{3,})(?!\\()\\s*", "g");
78 private static final RegExp ICC = RegExp.compile("icc-color\\(" + WS + "(" + PROFILE + ")(" + INTLIST + ")" + WS + "\\)", "g");
79
80 public static final SVGPaintParser INSTANCE = new SVGPaintParser();
81
82 public OMSVGPaint parse(String cssText) {
83 return parse(cssText, null);
84 }
85
86 private OMSVGPaint parse(String cssText, String uri) {
87 if (uri == null) {
88
89 FUNCIRI.setLastIndex(0);
90 MatchResult result = FUNCIRI.exec(cssText);
91 if (result != null && result.getGroupCount() == 2) {
92
93 String str = FUNCIRI.getLastIndex() == cssText.length() ? null : cssText.substring(FUNCIRI.getLastIndex());
94 return parse(str, result.getGroup(1));
95 }
96 }
97 String rgbColor = null;
98 String iccColor = null;
99 if (cssText != null) {
100 if (SVGConstants.CSS_NONE_VALUE.equals(cssText)) {
101
102 if (uri == null) {
103 return NONE;
104 }
105 OMSVGPaint paint = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_URI_NONE);
106 paint.setPaint(OMSVGPaint.SVG_PAINTTYPE_URI_NONE, uri, null, null);
107 return paint;
108 } else if (SVGConstants.CSS_INHERIT_VALUE.equals(cssText)) {
109
110 return INHERIT;
111 } else if (SVGConstants.CSS_CURRENTCOLOR_VALUE.equals(cssText)) {
112
113 if (uri == null) {
114 return CURRENT_COLOR;
115 }
116 OMSVGPaint paint = new OMSVGPaint(OMSVGPaint.SVG_PAINTTYPE_URI_CURRENTCOLOR);
117 paint.setPaint(OMSVGPaint.SVG_PAINTTYPE_URI_CURRENTCOLOR, uri, null, null);
118 return paint;
119 }
120
121 COLORNAME.setLastIndex(0);
122 MatchResult result = COLORNAME.exec(cssText);
123 if (result != null && result.getGroupCount() == 2) {
124
125 rgbColor = getNamedColor(result.getGroup(1));
126 if (rgbColor == null) {
127 throw new JavaScriptException("Unknown color keyword: " + cssText);
128 }
129 iccColor = COLORNAME.getLastIndex() == cssText.length() ? null : cssText.substring(COLORNAME.getLastIndex());
130 }
131
132 if (rgbColor == null) {
133 RGB255.setLastIndex(0);
134 result = RGB255.exec(cssText);
135 if (result != null && result.getGroupCount() == 4) {
136 rgbColor = result.getGroup(0);
137 iccColor = RGB255.getLastIndex() == cssText.length() ? null : cssText.substring(RGB255.getLastIndex());
138 }
139 }
140 if (rgbColor == null) {
141 RGBPCT.setLastIndex(0);
142 result = RGBPCT.exec(cssText);
143 if (result != null && result.getGroupCount() == 4) {
144 rgbColor = result.getGroup(0);
145 iccColor = RGBPCT.getLastIndex() == cssText.length() ? null : cssText.substring(RGBPCT.getLastIndex());
146 }
147 }
148 if (rgbColor == null) {
149 RGBHEX.setLastIndex(0);
150 result = RGBHEX.exec(cssText);
151 if (result != null && result.getGroupCount() == 2) {
152 rgbColor = result.getGroup(0);
153 iccColor = RGBHEX.getLastIndex() == cssText.length() ? null : cssText.substring(RGBHEX.getLastIndex());
154 }
155 }
156 }
157
158 short paintType;
159 if (rgbColor != null) {
160 if (uri != null) {
161 paintType = iccColor == null ? OMSVGPaint.SVG_PAINTTYPE_URI_RGBCOLOR : OMSVGPaint.SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR;
162 } else {
163 paintType = iccColor == null ? OMSVGPaint.SVG_PAINTTYPE_RGBCOLOR : OMSVGPaint.SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR;
164 }
165 } else {
166 if (uri != null) {
167 paintType = OMSVGPaint.SVG_PAINTTYPE_URI;
168 } else {
169 throw new JavaScriptException("Invalid paint spec: " + cssText);
170 }
171 }
172 OMSVGPaint paint = new OMSVGPaint(paintType);
173 paint.setPaint(paintType, uri, rgbColor, iccColor);
174 return paint;
175 }
176
177 public OMSVGICCColor iccColor(String str) {
178
179 ICC.setLastIndex(0);
180 MatchResult result = ICC.exec(str);
181 if (result != null && result.getGroupCount() == 3) {
182 String[] intArray = result.getGroup(2).split(COMMA);
183 List<Integer> intList = new ArrayList<Integer>();
184 for (int i = 0; i < intArray.length; i++) {
185 if (intArray[i].length() > 0) {
186 intList.add(Integer.parseInt(intArray[i]));
187 }
188 }
189 return new OMSVGICCColor(result.getGroup(1), intList);
190 }
191 throw new JavaScriptException("Invalid icc-color spec: " + str);
192 }
193
194 public OMRGBColor rgbColor(String str) {
195
196 RGB255.setLastIndex(0);
197 MatchResult result = RGB255.exec(str);
198 if (result != null && result.getGroupCount() == 4) {
199 return new OMRGBColor(
200 Integer.parseInt(result.getGroup(1)),
201 Integer.parseInt(result.getGroup(2)),
202 Integer.parseInt(result.getGroup(3)));
203 }
204 RGBPCT.setLastIndex(0);
205 result = RGBPCT.exec(str);
206 if (result != null && result.getGroupCount() == 4) {
207 return new OMRGBColor(
208 255 * Integer.parseInt(result.getGroup(1)) / 100,
209 255 * Integer.parseInt(result.getGroup(2)) / 100,
210 255 * Integer.parseInt(result.getGroup(3)) / 100);
211 }
212 RGBHEX.setLastIndex(0);
213 result = RGBHEX.exec(str);
214 if (result != null && result.getGroupCount() == 2) {
215 String hex = result.getGroup(1);
216 if (hex.length() == 3) {
217 return new OMRGBColor(
218 Integer.parseInt(hex.substring(0, 1), 16),
219 Integer.parseInt(hex.substring(1, 2), 16),
220 Integer.parseInt(hex.substring(2, 3), 16));
221 } else {
222 return new OMRGBColor(
223 Integer.parseInt(hex.substring(0, 2), 16),
224 Integer.parseInt(hex.substring(2, 4), 16),
225 Integer.parseInt(hex.substring(4, 6), 16));
226 }
227 }
228 throw new JavaScriptException("Invalid color spec: " + str);
229 }
230
231 public String getNamedColor(String str) {
232 if (nameToColor == null) {
233 nameToColor = new HashMap<String,String>();
234 nameToColor.put(SVGConstants.CSS_ALICEBLUE_VALUE, "240,248,255");
235 nameToColor.put(SVGConstants.CSS_ANTIQUEWHITE_VALUE, "250,235,215");
236 nameToColor.put(SVGConstants.CSS_AQUA_VALUE, " 0,255,255");
237 nameToColor.put(SVGConstants.CSS_AQUAMARINE_VALUE, "127,255,212");
238 nameToColor.put(SVGConstants.CSS_AZURE_VALUE, "240,255,255");
239 nameToColor.put(SVGConstants.CSS_BEIGE_VALUE, "245,245,220");
240 nameToColor.put(SVGConstants.CSS_BISQUE_VALUE, "255,228,196");
241 nameToColor.put(SVGConstants.CSS_BLACK_VALUE, " 0,0,0");
242 nameToColor.put(SVGConstants.CSS_BLANCHEDALMOND_VALUE, "255,235,205");
243 nameToColor.put(SVGConstants.CSS_BLUE_VALUE, " 0,0,255");
244 nameToColor.put(SVGConstants.CSS_BLUEVIOLET_VALUE, "138,43,226");
245 nameToColor.put(SVGConstants.CSS_BROWN_VALUE, "165,42,42");
246 nameToColor.put(SVGConstants.CSS_BURLYWOOD_VALUE, "222,184,135");
247 nameToColor.put(SVGConstants.CSS_CADETBLUE_VALUE, " 95,158,160");
248 nameToColor.put(SVGConstants.CSS_CHARTREUSE_VALUE, "127,255,0");
249 nameToColor.put(SVGConstants.CSS_CHOCOLATE_VALUE, "210,105,30");
250 nameToColor.put(SVGConstants.CSS_CORAL_VALUE, "255,127,80");
251 nameToColor.put(SVGConstants.CSS_CORNFLOWERBLUE_VALUE, "100,149,237");
252 nameToColor.put(SVGConstants.CSS_CORNSILK_VALUE, "255,248,220");
253 nameToColor.put(SVGConstants.CSS_CRIMSON_VALUE, "220,20,60");
254 nameToColor.put(SVGConstants.CSS_CYAN_VALUE, " 0,255,255");
255 nameToColor.put(SVGConstants.CSS_DARKBLUE_VALUE, " 0,0,139");
256 nameToColor.put(SVGConstants.CSS_DARKCYAN_VALUE, " 0,139,139");
257 nameToColor.put(SVGConstants.CSS_DARKGOLDENROD_VALUE, "184,134,11");
258 nameToColor.put(SVGConstants.CSS_DARKGRAY_VALUE, "169,169,169");
259 nameToColor.put(SVGConstants.CSS_DARKGREEN_VALUE, " 0,100,0");
260 nameToColor.put(SVGConstants.CSS_DARKGREY_VALUE, "169,169,169");
261 nameToColor.put(SVGConstants.CSS_DARKKHAKI_VALUE, "189,183,107");
262 nameToColor.put(SVGConstants.CSS_DARKMAGENTA_VALUE, "139,0,139");
263 nameToColor.put(SVGConstants.CSS_DARKOLIVEGREEN_VALUE, " 85,107,47");
264 nameToColor.put(SVGConstants.CSS_DARKORANGE_VALUE, "255,140,0");
265 nameToColor.put(SVGConstants.CSS_DARKORCHID_VALUE, "153,50,204");
266 nameToColor.put(SVGConstants.CSS_DARKRED_VALUE, "139,0,0");
267 nameToColor.put(SVGConstants.CSS_DARKSALMON_VALUE, "233,150,122");
268 nameToColor.put(SVGConstants.CSS_DARKSEAGREEN_VALUE, "143,188,143");
269 nameToColor.put(SVGConstants.CSS_DARKSLATEBLUE_VALUE, " 72,61,139");
270 nameToColor.put(SVGConstants.CSS_DARKSLATEGRAY_VALUE, " 47,79,79");
271 nameToColor.put(SVGConstants.CSS_DARKSLATEGREY_VALUE, " 47,79,79");
272 nameToColor.put(SVGConstants.CSS_DARKTURQUOISE_VALUE, " 0,206,209");
273 nameToColor.put(SVGConstants.CSS_DARKVIOLET_VALUE, "148,0,211");
274 nameToColor.put(SVGConstants.CSS_DEEPPINK_VALUE, "255,20,147");
275 nameToColor.put(SVGConstants.CSS_DEEPSKYBLUE_VALUE, " 0,191,255");
276 nameToColor.put(SVGConstants.CSS_DIMGRAY_VALUE, "105,105,105");
277 nameToColor.put(SVGConstants.CSS_DIMGREY_VALUE, "105,105,105");
278 nameToColor.put(SVGConstants.CSS_DODGERBLUE_VALUE, " 30,144,255");
279 nameToColor.put(SVGConstants.CSS_FIREBRICK_VALUE, "178,34,34");
280 nameToColor.put(SVGConstants.CSS_FLORALWHITE_VALUE, "255,250,240");
281 nameToColor.put(SVGConstants.CSS_FORESTGREEN_VALUE, " 34,139,34");
282 nameToColor.put(SVGConstants.CSS_FUCHSIA_VALUE, "255,0,255");
283 nameToColor.put(SVGConstants.CSS_GAINSBORO_VALUE, "220,220,220");
284 nameToColor.put(SVGConstants.CSS_GHOSTWHITE_VALUE, "248,248,255");
285 nameToColor.put(SVGConstants.CSS_GOLD_VALUE, "255,215,0");
286 nameToColor.put(SVGConstants.CSS_GOLDENROD_VALUE, "218,165,32");
287 nameToColor.put(SVGConstants.CSS_GRAY_VALUE, "128,128,128");
288 nameToColor.put(SVGConstants.CSS_GREY_VALUE, "128,128,128");
289 nameToColor.put(SVGConstants.CSS_GREEN_VALUE, " 0,128,0");
290 nameToColor.put(SVGConstants.CSS_GREENYELLOW_VALUE, "173,255,47");
291 nameToColor.put(SVGConstants.CSS_HONEYDEW_VALUE, "240,255,240");
292 nameToColor.put(SVGConstants.CSS_HOTPINK_VALUE, "255,105,180");
293 nameToColor.put(SVGConstants.CSS_INDIANRED_VALUE, "205,92,92");
294 nameToColor.put(SVGConstants.CSS_INDIGO_VALUE, " 75,0,130");
295 nameToColor.put(SVGConstants.CSS_IVORY_VALUE, "255,255,240");
296 nameToColor.put(SVGConstants.CSS_KHAKI_VALUE, "240,230,140");
297 nameToColor.put(SVGConstants.CSS_LAVENDER_VALUE, "230,230,250");
298 nameToColor.put(SVGConstants.CSS_LAVENDERBLUSH_VALUE, "255,240,245");
299 nameToColor.put(SVGConstants.CSS_LAWNGREEN_VALUE, "124,252,0");
300 nameToColor.put(SVGConstants.CSS_LEMONCHIFFON_VALUE, "255,250,205");
301 nameToColor.put(SVGConstants.CSS_LIGHTBLUE_VALUE, "173,216,230");
302 nameToColor.put(SVGConstants.CSS_LIGHTCORAL_VALUE, "240,128,128");
303 nameToColor.put(SVGConstants.CSS_LIGHTCYAN_VALUE, "224,255,255");
304 nameToColor.put(SVGConstants.CSS_LIGHTGOLDENRODYELLOW_VALUE, "250,250,210");
305 nameToColor.put(SVGConstants.CSS_LIGHTGRAY_VALUE, "211,211,211");
306 nameToColor.put(SVGConstants.CSS_LIGHTGREEN_VALUE, "144,238,144");
307 nameToColor.put(SVGConstants.CSS_LIGHTGREY_VALUE, "211,211,211) ");
308 nameToColor.put(SVGConstants.CSS_LIGHTPINK_VALUE, "255,182,193");
309 nameToColor.put(SVGConstants.CSS_LIGHTSALMON_VALUE, "255,160,122");
310 nameToColor.put(SVGConstants.CSS_LIGHTSEAGREEN_VALUE, " 32,178,170");
311 nameToColor.put(SVGConstants.CSS_LIGHTSKYBLUE_VALUE, "135,206,250");
312 nameToColor.put(SVGConstants.CSS_LIGHTSLATEGRAY_VALUE, "119,136,153");
313 nameToColor.put(SVGConstants.CSS_LIGHTSLATEGREY_VALUE, "119,136,153");
314 nameToColor.put(SVGConstants.CSS_LIGHTSTEELBLUE_VALUE, "176,196,222");
315 nameToColor.put(SVGConstants.CSS_LIGHTYELLOW_VALUE, "255,255,224");
316 nameToColor.put(SVGConstants.CSS_LIME_VALUE, " 0,255,0");
317 nameToColor.put(SVGConstants.CSS_LIMEGREEN_VALUE, " 50,205,50");
318 nameToColor.put(SVGConstants.CSS_LINEN_VALUE, "250,240,230");
319 nameToColor.put(SVGConstants.CSS_MAGENTA_VALUE, "255,0,255");
320 nameToColor.put(SVGConstants.CSS_MAROON_VALUE, "128,0,0");
321 nameToColor.put(SVGConstants.CSS_MEDIUMAQUAMARINE_VALUE, "102,205,170");
322 nameToColor.put(SVGConstants.CSS_MEDIUMBLUE_VALUE, " 0,0,205");
323 nameToColor.put(SVGConstants.CSS_MEDIUMORCHID_VALUE, "186,85,211");
324 nameToColor.put(SVGConstants.CSS_MEDIUMPURPLE_VALUE, "147,112,219");
325 nameToColor.put(SVGConstants.CSS_MEDIUMSEAGREEN_VALUE, " 60,179,113");
326 nameToColor.put(SVGConstants.CSS_MEDIUMSLATEBLUE_VALUE, "123,104,238");
327 nameToColor.put(SVGConstants.CSS_MEDIUMSPRINGGREEN_VALUE, " 0,250,154");
328 nameToColor.put(SVGConstants.CSS_MEDIUMTURQUOISE_VALUE, " 72,209,204");
329 nameToColor.put(SVGConstants.CSS_MEDIUMVIOLETRED_VALUE, "199,21,133");
330 nameToColor.put(SVGConstants.CSS_MIDNIGHTBLUE_VALUE, " 25,25,112");
331 nameToColor.put(SVGConstants.CSS_MINTCREAM_VALUE, "245,255,250");
332 nameToColor.put(SVGConstants.CSS_MISTYROSE_VALUE, "255,228,225");
333 nameToColor.put(SVGConstants.CSS_MOCCASIN_VALUE, "255,228,181");
334 nameToColor.put(SVGConstants.CSS_NAVAJOWHITE_VALUE, "255,222,173");
335 nameToColor.put(SVGConstants.CSS_NAVY_VALUE, " 0,0,128");
336 nameToColor.put(SVGConstants.CSS_OLDLACE_VALUE, "253,245,230");
337 nameToColor.put(SVGConstants.CSS_OLIVE_VALUE, "128,128,0");
338 nameToColor.put(SVGConstants.CSS_OLIVEDRAB_VALUE, "107,142,35");
339 nameToColor.put(SVGConstants.CSS_ORANGE_VALUE, "255,165,0");
340 nameToColor.put(SVGConstants.CSS_ORANGERED_VALUE, "255,69,0");
341 nameToColor.put(SVGConstants.CSS_ORCHID_VALUE, "218,112,214");
342 nameToColor.put(SVGConstants.CSS_PALEGOLDENROD_VALUE, "238,232,170");
343 nameToColor.put(SVGConstants.CSS_PALEGREEN_VALUE, "152,251,152");
344 nameToColor.put(SVGConstants.CSS_PALETURQUOISE_VALUE, "175,238,238");
345 nameToColor.put(SVGConstants.CSS_PALEVIOLETRED_VALUE, "219,112,147");
346 nameToColor.put(SVGConstants.CSS_PAPAYAWHIP_VALUE, "255,239,213");
347 nameToColor.put(SVGConstants.CSS_PEACHPUFF_VALUE, "255,218,185");
348 nameToColor.put(SVGConstants.CSS_PERU_VALUE, "205,133,63");
349 nameToColor.put(SVGConstants.CSS_PINK_VALUE, "255,192,203");
350 nameToColor.put(SVGConstants.CSS_PLUM_VALUE, "221,160,221");
351 nameToColor.put(SVGConstants.CSS_POWDERBLUE_VALUE, "176,224,230");
352 nameToColor.put(SVGConstants.CSS_PURPLE_VALUE, "128,0,128");
353 nameToColor.put(SVGConstants.CSS_RED_VALUE, "255,0,0");
354 nameToColor.put(SVGConstants.CSS_ROSYBROWN_VALUE, "188,143,143");
355 nameToColor.put(SVGConstants.CSS_ROYALBLUE_VALUE, " 65,105,225");
356 nameToColor.put(SVGConstants.CSS_SADDLEBROWN_VALUE, "139,69,19");
357 nameToColor.put(SVGConstants.CSS_SALMON_VALUE, "250,128,114");
358 nameToColor.put(SVGConstants.CSS_SANDYBROWN_VALUE, "244,164,96");
359 nameToColor.put(SVGConstants.CSS_SEAGREEN_VALUE, " 46,139,87");
360 nameToColor.put(SVGConstants.CSS_SEASHELL_VALUE, "255,245,238");
361 nameToColor.put(SVGConstants.CSS_SIENNA_VALUE, "160,82,45");
362 nameToColor.put(SVGConstants.CSS_SILVER_VALUE, "192,192,192");
363 nameToColor.put(SVGConstants.CSS_SKYBLUE_VALUE, "135,206,235");
364 nameToColor.put(SVGConstants.CSS_SLATEBLUE_VALUE, "106,90,205");
365 nameToColor.put(SVGConstants.CSS_SLATEGRAY_VALUE, "112,128,144");
366 nameToColor.put(SVGConstants.CSS_SLATEGREY_VALUE, "112,128,144");
367 nameToColor.put(SVGConstants.CSS_SNOW_VALUE, "255,250,250");
368 nameToColor.put(SVGConstants.CSS_SPRINGGREEN_VALUE, " 0,255,127");
369 nameToColor.put(SVGConstants.CSS_STEELBLUE_VALUE, " 70,130,180");
370 nameToColor.put(SVGConstants.CSS_TAN_VALUE, "210,180,140");
371 nameToColor.put(SVGConstants.CSS_TEAL_VALUE, " 0,128,128");
372 nameToColor.put(SVGConstants.CSS_THISTLE_VALUE, "216,191,216");
373 nameToColor.put(SVGConstants.CSS_TOMATO_VALUE, "255,99,71");
374 nameToColor.put(SVGConstants.CSS_TURQUOISE_VALUE, " 64,224,208");
375 nameToColor.put(SVGConstants.CSS_VIOLET_VALUE, "238,130,238");
376 nameToColor.put(SVGConstants.CSS_WHEAT_VALUE, "245,222,179");
377 nameToColor.put(SVGConstants.CSS_WHITE_VALUE, "255,255,255");
378 nameToColor.put(SVGConstants.CSS_WHITESMOKE_VALUE, "245,245,245");
379 nameToColor.put(SVGConstants.CSS_YELLOW_VALUE, "255,255,0");
380 nameToColor.put(SVGConstants.CSS_YELLOWGREEN_VALUE, "154,205,50");
381 }
382
383 String color = nameToColor.get(str);
384 return color != null ? "rgb(" + color + ")" : null;
385 }
386 }