1
2 package org.catacomb.util;
3
4
5 import org.catacomb.interlish.structure.AddableTo;
6 import org.catacomb.report.E;
7
8
9 import java.awt.Color;
10 import java.util.HashMap;
11
12
13 public class StandardColors implements AddableTo {
14
15 HashMap<String, Color> colors;
16
17 public StandardColors() {
18 colors = new HashMap<String, Color>();
19 }
20
21
22 public boolean defines(String s) {
23 return colors.containsKey(s);
24 }
25
26 public Color getColor(String s) {
27 return colors.get(s);
28 }
29
30
31
32 public void add(Object obj) {
33 if (obj instanceof ColorDef) {
34 ColorDef cdef = (ColorDef)obj;
35 colors.put(cdef.getName(), cdef.getColor());
36
37 } else {
38 E.error("standard colors cant use " + obj);
39 }
40 }
41
42
43 }