/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* JavaWorld Library, Copyright 2011 Bryan Chadwick *
* *
* FILE: ./image/ColorDatabase.java *
* *
* This file is part of JavaWorld. *
* *
* JavaWorld is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation, either version *
* 3 of the License, or (at your option) any later version. *
* *
* JavaWorld is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with JavaWorld. If not, see . *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package image;
import java.awt.Color;
import java.util.HashMap;
/**
*
*
* Manages color names and translation to implementation-dependent Color structures.
*
*
* Available colors are listed in the following table. If an undefined color is used then a RuntimeException
* is thrown. Custom colors can be created using the static {@link ColorDatabase#makeColor makeColor} methods.
*
*
* Alternatively clients can specify a 7 character string beginning with a '#' (hash-mark)
* followed by a 6 digit hexadecimal number that encodes the requested RGB color
* (Red, Green, Blue), e.g., "#FF0000" for Red, or
* "#00FF00" for Green.
* For advanced users, a 9 character string beginning with a '#' followed by an 8 digit
* hexadecimal number that encodes the requested ARGB color (Alpha, Red, Green, Blue), e.g.,
* "#FFFF0000" for Opaque Red, or "#8800FF00"
* for Half-Transparent Green.
*
*
* Color names are case-insensitive.
*
*
*
*
* "orange red" | |
* "orangered" | |
* "tomato" | |
* "darkred" | |
* "red" | |
* "firebrick" | |
* "crimson" | |
* "deeppink" | |
* "maroon" | |
* "indian red" | |
* "indianred" | |
* "medium violet red" | |
* "mediumvioletred" | |
* "violet red" | |
* "violetred" | |
* "lightcoral" | |
* "hotpink" | |
* "palevioletred" | |
* "lightpink" | |
* "rosybrown" | |
* "pink" | |
* "orchid" | |
* "lavenderblush" | |
* "snow" | |
* "chocolate" | |
* "saddlebrown" | |
* "brown" | |
* "darkorange" | |
* "coral" | |
* "sienna" | |
* "orange" | |
* "salmon" | |
* "peru" | |
* "darkgoldenrod" | |
* "goldenrod" | |
* "sandybrown" | |
* "lightsalmon" | |
* "darksalmon" | |
* "gold" | |
* "yellow" | |
* "olive" | |
* "burlywood" | |
* "tan" | |
* "navajowhite" | |
* "peachpuff" | |
* "khaki" | |
* "darkkhaki" | |
* "moccasin" | |
* "wheat" | |
* "bisque" | |
* "palegoldenrod" | |
* "blanchedalmond" | |
* "medium goldenrod" | |
* "mediumgoldenrod" | |
* "papayawhip" | |
* "mistyrose" | |
* "lemonchiffon" | |
* "antiquewhite" | |
* "cornsilk" | |
* "lightgoldenrodyellow" | |
* "oldlace" | |
* "linen" | |
* "lightyellow" | |
* "seashell" | |
* "beige" | |
* "floralwhite" | |
* "ivory" | |
* "green" | |
* "lawngreen" | |
* "chartreuse" | |
* "green yellow" | |
* "greenyellow" | |
* "yellow green" | |
* "yellowgreen" | |
* "medium forest green" | |
* "olivedrab" | |
* "mediumforestgreen" | |
* "dark olive green" | |
* "darkolivegreen" | |
* "darkseagreen" | |
* "lime" | |
* "dark green" | |
* "darkgreen" | |
* "lime green" | |
* "limegreen" | |
* "forest green" | |
* "forestgreen" | |
* "spring green" | |
* "springgreen" | |
* "medium spring green" | |
* "mediumspringgreen" | |
* "sea green" | |
* "seagreen" | |
* "medium sea green" | |
* "mediumseagreen" | |
* "aquamarine" | |
* "lightgreen" | |
* "pale green" | |
* "palegreen" | |
* "medium aquamarine" | |
* "mediumaquamarine" | |
* "turquoise" | |
* "lightseagreen" | |
* "medium turquoise" | |
* "mediumturquoise" | |
* "honeydew" | |
* "mintcream" | |
* "royalblue" | |
* "dodgerblue" | |
* "deepskyblue" | |
* "cornflowerblue" | |
* "steel blue" | |
* "steelblue" | |
* "lightskyblue" | |
* "dark turquoise" | |
* "darkturquoise" | |
* "cyan" | |
* "aqua" | |
* "darkcyan" | |
* "teal" | |
* "sky blue" | |
* "skyblue" | |
* "cadet blue" | |
* "cadetblue" | |
* "dark slate gray" | |
* "darkslategray" | |
* "lightslategray" | |
* "slategray" | |
* "dark slate grey" | |
* "darkslategrey" | |
* "lightslategrey" | |
* "slategrey" | |
* "light steel blue" | |
* "lightsteelblue" | |
* "light blue" | |
* "lightblue" | |
* "powderblue" | |
* "paleturquoise" | |
* "lightcyan" | |
* "aliceblue" | |
* "azure" | |
* "medium blue" | |
* "mediumblue" | |
* "darkblue" | |
* "midnight blue" | |
* "midnightblue" | |
* "navy" | |
* "blue" | |
* "indigo" | |
* "blue violet" | |
* "blueviolet" | |
* "medium slate blue" | |
* "mediumslateblue" | |
* "slate blue" | |
* "slateblue" | |
* "purple" | |
* "dark slate blue" | |
* "darkslateblue" | |
* "darkviolet" | |
* "dark orchid" | |
* "darkorchid" | |
* "mediumpurple" | |
* "cornflower blue" | |
* "medium orchid" | |
* "mediumorchid" | |
* "magenta" | |
* "fuchsia" | |
* "darkmagenta" | |
* "violet" | |
* "plum" | |
* "lavender" | |
* "thistle" | |
* "ghostwhite" | |
* "white" | |
* "whitesmoke" | |
* "gainsboro" | |
* "light gray" | |
* "lightgray" | |
* "light grey" | |
* "lightgrey" | |
* "silver" | |
* "gray" | |
* "dark gray" | |
* "darkgray" | |
* "dim gray" | |
* "dimgray" | |
* "grey" | |
* "dark grey" | |
* "darkgrey" | |
* "dim grey" | |
* "dimgrey" | |
* "black" | |
*
*
*
*/
public class ColorDatabase {
/** Get the {@link java.awt.Color} represented by the given string */
public static Color color(String s){
s = s.toLowerCase();
if(s.startsWith("#") && (s.length() == 7 || s.length() == 9))
return parseColor(s.substring(1));
if(colorTable.containsKey(s))
return colorTable.get(s);
throw new InvalidColorException("In valid color: \""+s+"\"");
}
/** The Hexidecimal Digits as a String (in order) */
private static String HEX_DIGITS = "0123456789ABCDEF";
/** Create a color String from the given Alpha/Red/Green/Blue intensities in [0..255]. */
public static String makeColor(int red, int green, int blue){
return makeColor(255, red, blue, green);
}
/** Create a color String from the given Alpha/Red/Green/Blue intensities in [0..255]. */
public static String makeColor(int alpha, int red, int green, int blue){
alpha = Math.min(alpha, 255);
red = Math.min(red, 255);
green = Math.min(green, 255);
blue = Math.min(blue, 255);
return "#"+HEX_DIGITS.charAt(alpha/16%16)+
HEX_DIGITS.charAt(alpha%16)+
HEX_DIGITS.charAt(red/16%16)+
HEX_DIGITS.charAt(red%16)+
HEX_DIGITS.charAt(green/16%16)+
HEX_DIGITS.charAt(green%16)+
HEX_DIGITS.charAt(blue/16%16)+
HEX_DIGITS.charAt(blue%16);
}
/** Create a color String from the given Red/Green/Blue fractional intensities in [0..1.0]. */
public static String makeColor(double red, double green, double blue){
return makeColor(1.0, red, green, blue);
}
/** Create a color String from the given Alpha/Red/Green/Blue fractional intensities in [0..1.0]. */
public static String makeColor(double alpha, double red, double green, double blue){
return makeColor((int)(alpha*255), (int)(red*255), (int)(green*255), (int)(blue*255));
}
/** Create a {@link java.awt.Color} from the given Red/Green/Blue fractional intensities in [0..1.0]. */
public static Color makeAwtColor(double red, double green, double blue){
return makeAwtColor(1.0, red, green, blue);
}
/** Create a {@link java.awt.Color} from the given Alpha/Red/Green/Blue fractional intensities in [0..1.0]. */
public static Color makeAwtColor(double alpha, double red, double green, double blue){
return makeAwtColor((int)(alpha*255), (int)(red*255), (int)(green*255), (int)(blue*255));
}
/** Create a {@link java.awt.Color} from the given Alpha/Red/Green/Blue intensities in [0..255]. */
public static Color makeAwtColor(int red, int green, int blue){
return makeAwtColor(255, red, blue, green);
}
/** Create a {@link java.awt.Color} from the given Alpha/Red/Green/Blue intensities in [0..255]. */
public static Color makeAwtColor(int alpha, int red, int green, int blue){
alpha = Math.min(alpha, 255);
red = Math.min(red, 255);
green = Math.min(green, 255);
blue = Math.min(blue, 255);
return new Color(red, green, blue, alpha);
}
/** Convert the given Color String into ARGB integer format. */
public static int colorToARGB(String c){
Color awt = color(c);
return colorToARGB(awt.getAlpha(), awt.getRed(), awt.getGreen(), awt.getBlue());
}
/** Convert the given Color intensities into ARGB integer format.
* RGB intensities must be between 0 and 1.0, inclusive.*/
public static int colorToARGB(double red, double green, double blue){
return colorToARGB(1.0, red, green, blue);
}
/** Convert the given Alpha and Color intensities into ARGB integer
* format. ARGB intensities must be between 0 and 1.0, inclusive.*/
public static int colorToARGB(double alpha, double red, double green, double blue){
return colorToARGB((int)(alpha*255), (int)(red*255), (int)(green*255), (int)(blue*255));
}
/** Convert the given Color intensities into ARGB integer format.
* RGB intensities must be between 0 and 255, inclusive. */
public static int colorToARGB(int red, int green, int blue){
return colorToARGB(255, red, green, blue);
}
private static int ALPHA_SHIFT = 24;
private static int RED_SHIFT = 16;
private static int GREEN_SHIFT = 8;
private static int BLUE_SHIFT = 0;
/** Convert the given Alpha and Color intensities into ARGB integer
* format. ARGB intensities must be between 0 and 255, inclusive.*/
public static int colorToARGB(int alpha, int red, int green, int blue){
alpha = Math.min(alpha, 255);
red = Math.min(red, 255);
green = Math.min(green, 255);
blue = Math.min(blue, 255);
return (alpha<>ALPHA_SHIFT)&0xFF,
(color>>RED_SHIFT)&0xFF,
(color>>GREEN_SHIFT)&0xFF,
(color>>BLUE_SHIFT)&0xFF);
}
/** Create a {@link java.awt.Color} from the given integer that encodes Alpha/Red/Green/Blue
* intensities. Each of the low-order bytes encodes an intensity
* in [0..255] where the Alpha/Red/Green/Blue/Alpha are in order from high to low
* order bytes. */
public static Color makeAwtColor(int color){
return makeAwtColor((color>>ALPHA_SHIFT)&0xFF,
(color>>RED_SHIFT)&0xFF,
(color>>GREEN_SHIFT)&0xFF,
(color>>BLUE_SHIFT)&0xFF);
}
/** Parse a hex-Color from a 6 digit String (two each for Red, Green, Blue */
private static Color parseColor(String c){
String one = c.substring(0,2);
String two = c.substring(2,4);
String thr = c.substring(4,6);
try{
if(c.length() == 6){
return new Color(Integer.parseInt(one, 16),
Integer.parseInt(two, 16),
Integer.parseInt(thr, 16));
}else{
return new Color(Integer.parseInt(two, 16),
Integer.parseInt(thr, 16),
Integer.parseInt(c.substring(6,8), 16),
Integer.parseInt(one, 16));
}
}catch(Exception e){
throw new InvalidColorException("In valid custom color: \"#"+c+"\"");
}
}
/** Thrown when an invalid color is used */
public static class InvalidColorException extends RuntimeException{
private static final long serialVersionUID = 1;
private InvalidColorException(String s){ super(s); }
}
/** Available colors... */
private static HashMap colorTable = new HashMap();
static{
colorTable.put("orangered", new Color(0xff, 0x45, 0x00));
colorTable.put("tomato", new Color(0xff, 0x63, 0x47));
colorTable.put("darkred", new Color(0x8b, 0x00, 0x00));
colorTable.put("red", new Color(0xff, 0x00, 0x00));
colorTable.put("firebrick", new Color(0xb2, 0x22, 0x22));
colorTable.put("crimson", new Color(0xdc, 0x14, 0x3c));
colorTable.put("deeppink", new Color(0xff, 0x14, 0x93));
colorTable.put("maroon", new Color(0xb0, 0x30, 0x60));
colorTable.put("indian red", new Color(0xcd, 0x5c, 0x5c));
colorTable.put("indianred", new Color(0xcd, 0x5c, 0x5c));
colorTable.put("medium violet red", new Color(0xc7, 0x15, 0x85));
colorTable.put("mediumvioletred", new Color(0xc7, 0x15, 0x85));
colorTable.put("violet red", new Color(0xd0, 0x20, 0x90));
colorTable.put("violetred", new Color(0xd0, 0x20, 0x90));
colorTable.put("lightcoral", new Color(0xf0, 0x80, 0x80));
colorTable.put("hotpink", new Color(0xff, 0x69, 0xb4));
colorTable.put("palevioletred", new Color(0xdb, 0x70, 0x93));
colorTable.put("lightpink", new Color(0xff, 0xb6, 0xc1));
colorTable.put("rosybrown", new Color(0xbc, 0x8f, 0x8f));
colorTable.put("pink", new Color(0xff, 0xc0, 0xcb));
colorTable.put("orchid", new Color(0xda, 0x70, 0xd6));
colorTable.put("lavenderblush", new Color(0xff, 0xf0, 0xf5));
colorTable.put("snow", new Color(0xff, 0xfa, 0xfa));
colorTable.put("chocolate", new Color(0xd2, 0x69, 0x1e));
colorTable.put("saddlebrown", new Color(0x8b, 0x45, 0x13));
colorTable.put("brown", new Color(0x84, 0x3c, 0x24));
colorTable.put("darkorange", new Color(0xff, 0x8c, 0x00));
colorTable.put("coral", new Color(0xff, 0x7f, 0x50));
colorTable.put("sienna", new Color(0xa0, 0x52, 0x2d));
colorTable.put("orange", new Color(0xff, 0xa5, 0x00));
colorTable.put("salmon", new Color(0xfa, 0x80, 0x72));
colorTable.put("peru", new Color(0xcd, 0x85, 0x3f));
colorTable.put("darkgoldenrod", new Color(0xb8, 0x86, 0x0b));
colorTable.put("goldenrod", new Color(0xda, 0xa5, 0x20));
colorTable.put("sandybrown", new Color(0xf4, 0xa4, 0x60));
colorTable.put("lightsalmon", new Color(0xff, 0xa0, 0x7a));
colorTable.put("darksalmon", new Color(0xe9, 0x96, 0x7a));
colorTable.put("gold", new Color(0xff, 0xd7, 0x00));
colorTable.put("yellow", new Color(0xff, 0xff, 0x00));
colorTable.put("olive", new Color(0x80, 0x80, 0x00));
colorTable.put("burlywood", new Color(0xde, 0xb8, 0x87));
colorTable.put("tan", new Color(0xd2, 0xb4, 0x8c));
colorTable.put("navajowhite", new Color(0xff, 0xde, 0xad));
colorTable.put("peachpuff", new Color(0xff, 0xda, 0xb9));
colorTable.put("khaki", new Color(0xf0, 0xe6, 0x8c));
colorTable.put("darkkhaki", new Color(0xbd, 0xb7, 0x6b));
colorTable.put("moccasin", new Color(0xff, 0xe4, 0xb5));
colorTable.put("wheat", new Color(0xf5, 0xde, 0xb3));
colorTable.put("bisque", new Color(0xff, 0xe4, 0xc4));
colorTable.put("palegoldenrod", new Color(0xee, 0xe8, 0xaa));
colorTable.put("blanchedalmond", new Color(0xff, 0xeb, 0xcd));
colorTable.put("medium goldenrod", new Color(0xea, 0xea, 0xad));
colorTable.put("mediumgoldenrod", new Color(0xea, 0xea, 0xad));
colorTable.put("papayawhip", new Color(0xff, 0xef, 0xd5));
colorTable.put("mistyrose", new Color(0xff, 0xe4, 0xe1));
colorTable.put("lemonchiffon", new Color(0xff, 0xfa, 0xcd));
colorTable.put("antiquewhite", new Color(0xfa, 0xeb, 0xd7));
colorTable.put("cornsilk", new Color(0xff, 0xf8, 0xdc));
colorTable.put("lightgoldenrodyellow", new Color(0xfa, 0xfa, 0xd2));
colorTable.put("oldlace", new Color(0xfd, 0xf5, 0xe6));
colorTable.put("linen", new Color(0xfa, 0xf0, 0xe6));
colorTable.put("lightyellow", new Color(0xff, 0xff, 0xe0));
colorTable.put("seashell", new Color(0xff, 0xf5, 0xee));
colorTable.put("beige", new Color(0xf5, 0xf5, 0xdc));
colorTable.put("floralwhite", new Color(0xff, 0xfa, 0xf0));
colorTable.put("ivory", new Color(0xff, 0xff, 0xf0));
colorTable.put("green", new Color(0x00, 0xff, 0x00));
colorTable.put("lawngreen", new Color(0x7c, 0xfc, 0x00));
colorTable.put("chartreuse", new Color(0x7f, 0xff, 0x00));
colorTable.put("green yellow", new Color(0xad, 0xff, 0x2f));
colorTable.put("greenyellow", new Color(0xad, 0xff, 0x2f));
colorTable.put("yellow green", new Color(0x9a, 0xcd, 0x32));
colorTable.put("yellowgreen", new Color(0x9a, 0xcd, 0x32));
colorTable.put("medium forest green", new Color(0x6b, 0x8e, 0x23));
colorTable.put("olivedrab", new Color(0x6b, 0x8e, 0x23));
colorTable.put("mediumforestgreen", new Color(0x6b, 0x8e, 0x23));
colorTable.put("dark olive green", new Color(0x55, 0x6b, 0x2f));
colorTable.put("darkolivegreen", new Color(0x55, 0x6b, 0x2f));
colorTable.put("darkseagreen", new Color(0x8f, 0xbc, 0x8b));
colorTable.put("lime", new Color(0x00, 0xff, 0x00));
colorTable.put("dark green", new Color(0x00, 0x64, 0x00));
colorTable.put("darkgreen", new Color(0x00, 0x64, 0x00));
colorTable.put("lime green", new Color(0x32, 0xcd, 0x32));
colorTable.put("limegreen", new Color(0x32, 0xcd, 0x32));
colorTable.put("forest green", new Color(0x22, 0x8b, 0x22));
colorTable.put("forestgreen", new Color(0x22, 0x8b, 0x22));
colorTable.put("spring green", new Color(0x00, 0xff, 0x7f));
colorTable.put("springgreen", new Color(0x00, 0xff, 0x7f));
colorTable.put("medium spring green", new Color(0x00, 0xfa, 0x9a));
colorTable.put("mediumspringgreen", new Color(0x00, 0xfa, 0x9a));
colorTable.put("sea green", new Color(0x2e, 0x8b, 0x57));
colorTable.put("seagreen", new Color(0x2e, 0x8b, 0x57));
colorTable.put("medium sea green", new Color(0x3c, 0xb3, 0x71));
colorTable.put("mediumseagreen", new Color(0x3c, 0xb3, 0x71));
colorTable.put("aquamarine", new Color(0x70, 0xd8, 0x90));
colorTable.put("lightgreen", new Color(0x90, 0xee, 0x90));
colorTable.put("pale green", new Color(0x98, 0xfb, 0x98));
colorTable.put("palegreen", new Color(0x98, 0xfb, 0x98));
colorTable.put("medium aquamarine", new Color(0x66, 0xcd, 0xaa));
colorTable.put("mediumaquamarine", new Color(0x66, 0xcd, 0xaa));
colorTable.put("turquoise", new Color(0x40, 0xe0, 0xd0));
colorTable.put("lightseagreen", new Color(0x20, 0xb2, 0xaa));
colorTable.put("medium turquoise", new Color(0x48, 0xd1, 0xcc));
colorTable.put("mediumturquoise", new Color(0x48, 0xd1, 0xcc));
colorTable.put("honeydew", new Color(0xf0, 0xff, 0xf0));
colorTable.put("mintcream", new Color(0xf5, 0xff, 0xfa));
colorTable.put("royalblue", new Color(0x41, 0x69, 0xe1));
colorTable.put("dodgerblue", new Color(0x1e, 0x90, 0xff));
colorTable.put("deepskyblue", new Color(0x00, 0xbf, 0xff));
colorTable.put("cornflowerblue", new Color(0x64, 0x95, 0xed));
colorTable.put("steel blue", new Color(0x46, 0x82, 0xb4));
colorTable.put("steelblue", new Color(0x46, 0x82, 0xb4));
colorTable.put("lightskyblue", new Color(0x87, 0xce, 0xfa));
colorTable.put("dark turquoise", new Color(0x00, 0xce, 0xd1));
colorTable.put("darkturquoise", new Color(0x00, 0xce, 0xd1));
colorTable.put("cyan", new Color(0x00, 0xff, 0xff));
colorTable.put("aqua", new Color(0x00, 0xff, 0xff));
colorTable.put("darkcyan", new Color(0x00, 0x8b, 0x8b));
colorTable.put("teal", new Color(0x00, 0x80, 0x80));
colorTable.put("sky blue", new Color(0x87, 0xce, 0xeb));
colorTable.put("skyblue", new Color(0x87, 0xce, 0xeb));
colorTable.put("cadet blue", new Color(0x60, 0xa0, 0xa0));
colorTable.put("cadetblue", new Color(0x5f, 0x9e, 0xa0));
colorTable.put("dark slate gray", new Color(0x2f, 0x4f, 0x4f));
colorTable.put("darkslategray", new Color(0x2f, 0x4f, 0x4f));
colorTable.put("lightslategray", new Color(0x77, 0x88, 0x99));
colorTable.put("slategray", new Color(0x70, 0x80, 0x90));
colorTable.put("dark slate grey", new Color(0x2f, 0x4f, 0x4f));
colorTable.put("darkslategrey", new Color(0x2f, 0x4f, 0x4f));
colorTable.put("lightslategrey", new Color(0x77, 0x88, 0x99));
colorTable.put("slategrey", new Color(0x70, 0x80, 0x90));
colorTable.put("light steel blue", new Color(0xb0, 0xc4, 0xde));
colorTable.put("lightsteelblue", new Color(0xb0, 0xc4, 0xde));
colorTable.put("light blue", new Color(0xad, 0xd8, 0xe6));
colorTable.put("lightblue", new Color(0xad, 0xd8, 0xe6));
colorTable.put("powderblue", new Color(0xb0, 0xe0, 0xe6));
colorTable.put("paleturquoise", new Color(0xaf, 0xee, 0xee));
colorTable.put("lightcyan", new Color(0xe0, 0xff, 0xff));
colorTable.put("aliceblue", new Color(0xf0, 0xf8, 0xff));
colorTable.put("azure", new Color(0xf0, 0xff, 0xff));
colorTable.put("medium blue", new Color(0x00, 0x00, 0xcd));
colorTable.put("mediumblue", new Color(0x00, 0x00, 0xcd));
colorTable.put("darkblue", new Color(0x00, 0x00, 0x8b));
colorTable.put("midnight blue", new Color(0x19, 0x19, 0x70));
colorTable.put("midnightblue", new Color(0x19, 0x19, 0x70));
colorTable.put("navy", new Color(0x24, 0x24, 0x8c));
colorTable.put("blue", new Color(0x00, 0x00, 0xff));
colorTable.put("indigo", new Color(0x4b, 0x00, 0x82));
colorTable.put("blue violet", new Color(0x8a, 0x2b, 0xe2));
colorTable.put("blueviolet", new Color(0x8a, 0x2b, 0xe2));
colorTable.put("medium slate blue", new Color(0x7b, 0x68, 0xee));
colorTable.put("mediumslateblue", new Color(0x7b, 0x68, 0xee));
colorTable.put("slate blue", new Color(0x6a, 0x5a, 0xcd));
colorTable.put("slateblue", new Color(0x6a, 0x5a, 0xcd));
colorTable.put("purple", new Color(0xa0, 0x20, 0xf0));
colorTable.put("dark slate blue", new Color(0x48, 0x3d, 0x8b));
colorTable.put("darkslateblue", new Color(0x48, 0x3d, 0x8b));
colorTable.put("darkviolet", new Color(0x94, 0x00, 0xd3));
colorTable.put("dark orchid", new Color(0x99, 0x32, 0xcc));
colorTable.put("darkorchid", new Color(0x99, 0x32, 0xcc));
colorTable.put("mediumpurple", new Color(0x93, 0x70, 0xdb));
colorTable.put("cornflower blue", new Color(0x44, 0x40, 0x6c));
colorTable.put("medium orchid", new Color(0xba, 0x55, 0xd3));
colorTable.put("mediumorchid", new Color(0xba, 0x55, 0xd3));
colorTable.put("magenta", new Color(0xff, 0x00, 0xff));
colorTable.put("fuchsia", new Color(0xff, 0x00, 0xff));
colorTable.put("darkmagenta", new Color(0x8b, 0x00, 0x8b));
colorTable.put("violet", new Color(0xee, 0x82, 0xee));
colorTable.put("plum", new Color(0xdd, 0xa0, 0xdd));
colorTable.put("lavender", new Color(0xe6, 0xe6, 0xfa));
colorTable.put("thistle", new Color(0xd8, 0xbf, 0xd8));
colorTable.put("ghostwhite", new Color(0xf8, 0xf8, 0xff));
colorTable.put("white", new Color(0xff, 0xff, 0xff));
colorTable.put("whitesmoke", new Color(0xf5, 0xf5, 0xf5));
colorTable.put("gainsboro", new Color(0xdc, 0xdc, 0xdc));
colorTable.put("light gray", new Color(0xd3, 0xd3, 0xd3));
colorTable.put("lightgray", new Color(0xd3, 0xd3, 0xd3));
colorTable.put("light grey", new Color(0xd3, 0xd3, 0xd3));
colorTable.put("lightgrey", new Color(0xd3, 0xd3, 0xd3));
colorTable.put("silver", new Color(0xc0, 0xc0, 0xc0));
colorTable.put("gray", new Color(0xbe, 0xbe, 0xbe));
colorTable.put("dark gray", new Color(0xa9, 0xa9, 0xa9));
colorTable.put("darkgray", new Color(0xa9, 0xa9, 0xa9));
colorTable.put("dim gray", new Color(0x69, 0x69, 0x69));
colorTable.put("dimgray", new Color(0x69, 0x69, 0x69));
colorTable.put("grey", new Color(0xbe, 0xbe, 0xbe));
colorTable.put("dark grey", new Color(0xa9, 0xa9, 0xa9));
colorTable.put("darkgrey", new Color(0xa9, 0xa9, 0xa9));
colorTable.put("dim grey", new Color(0x69, 0x69, 0x69));
colorTable.put("dimgrey", new Color(0x69, 0x69, 0x69));
colorTable.put("black", new Color(0x00, 0x00, 0x00));
}
}