0001: /*
0002: * Copyright Javelin Software, All rights reserved.
0003: */
0004:
0005: package com.javelin.swinglets;
0006:
0007: import java.util.*;
0008:
0009: /**
0010: * SColor is a Support class for mapping AWT colors to web colors.
0011: * <P>
0012: * SColor caches SColor objects, as well as the Hex Strings used to
0013: * render colors to web pages.
0014: * <P>
0015: * SColor allows colors to be loaded by name using the getColor() method.
0016: * The following colors are available.
0017: * <P>
0018: * snow,ghost white,ghostwhite,white smoke,whitesmoke,gainsboro,floral white,
0019: * floralwhite,old lace,oldlace,linen,antique white,antiquewhite,papaya whip,
0020: * papayawhip,blanched almond,blanchedalmond,bisque,peach puff,peachpuff,
0021: * navajo white,navajowhite,moccasin,cornsilk,ivory,lemon chiffon,lemonchiffon,
0022: * seashell,honeydew,mint cream,mintcream,azure,alice blue,aliceblue,lavender,
0023: * lavender blush,lavenderblush,misty rose,mistyrose,white,black,dark slate gray,
0024: * darkslategray,dark slate grey,darkslategrey,dim gray,dimgray,dim grey,
0025: * dimgrey,slate gray,slategray,slate grey,slategrey,light slate gray,
0026: * lightslategray,light slate grey,lightslategrey,gray,grey,light grey,
0027: * lightgrey,light gray,lightgray,midnight blue,midnightblue,navy,
0028: * navy blue,navyblue,cornflower blue,cornflowerblue,dark slate blue,
0029: * darkslateblue,slate blue,slateblue,medium slate blue,mediumslateblue,
0030: * light slate blue,lightslateblue,medium blue,mediumblue,royal blue,
0031: * royalblue,blue,dodger blue,dodgerblue,deep sky blue,deepskyblue,
0032: * sky blue,skyblue,light sky blue,lightskyblue,steel blue,steelblue,
0033: * light steel blue,lightsteelblue,light blue,lightblue,powder blue,
0034: * powderblue,pale turquoise,paleturquoise,dark turquoise,darkturquoise,
0035: * medium turquoise,mediumturquoise,turquoise,cyan,light cyan,lightcyan,
0036: * cadet blue,cadetblue,medium aquamarine,mediumaquamarine,aquamarine,
0037: * dark green,darkgreen,dark olive green,darkolivegreen,dark sea green,
0038: * darkseagreen,sea green,seagreen,medium sea green,mediumseagreen,
0039: * light sea green,lightseagreen,pale green,palegreen,spring green,
0040: * springgreen,lawn green,lawngreen,green,chartreuse,medium spring green,
0041: * mediumspringgreen,green yellow,greenyellow,lime green,limegreen,yellow green,
0042: * yellowgreen,forest green,forestgreen,olive drab,olivedrab,dark khaki,
0043: * darkkhaki,khaki,pale goldenrod,palegoldenrod,light goldenrod yellow,
0044: * lightgoldenrodyellow,light yellow,lightyellow,yellow,gold,light goldenrod,
0045: * lightgoldenrod,goldenrod,dark goldenrod,darkgoldenrod,rosy brown,
0046: * rosybrown,indian red,indianred,saddle brown,saddlebrown,sienna,
0047: * peru,burlywood,beige,wheat,sandy brown,sandybrown,tan,chocolate,firebrick,
0048: * brown,dark salmon,darksalmon,salmon,light salmon,lightsalmon,
0049: * orange,dark orange,darkorange,coral,light coral,lightcoral,
0050: * tomato,orange red,orangered,red,hot pink,hotpink,deep pink,deeppink,
0051: * pink,light pink,lightpink,pale violet red,palevioletred,
0052: * maroon,medium violet red,mediumvioletred,violet red,violetred,magenta,
0053: * violet,plum,orchid,medium orchid,mediumorchid,dark orchid,darkorchid,
0054: * dark violet,darkviolet,blue violet,blueviolet,purple,medium purple,
0055: * mediumpurple,thistle,snow1,snow2,snow3,snow4,seashell1,seashell2,
0056: * seashell3,seashell4,antiquewhite1,antiquewhite2,antiquewhite3,antiquewhite4,
0057: * bisque1,bisque2,bisque3,bisque4,peachpuff1,peachpuff2,peachpuff3,peachpuff4,
0058: * navajowhite1,navajowhite2,navajowhite3,navajowhite4,lemonchiffon1,
0059: * lemonchiffon2,lemonchiffon3,lemonchiffon4,cornsilk1,cornsilk2,
0060: * cornsilk3,cornsilk4,ivory1,ivory2,ivory3,ivory4,honeydew1,honeydew2,
0061: * honeydew3,honeydew4,lavenderblush1,lavenderblush2,lavenderblush3,
0062: * lavenderblush4,mistyrose1,mistyrose2,mistyrose3,mistyrose4,azure1,
0063: * azure2,azure3,azure4,slateblue1,slateblue2,slateblue3,slateblue4,
0064: * royalblue1,royalblue2,royalblue3,royalblue4,blue1,blue2,blue3,blue4,
0065: * dodgerblue1,dodgerblue2,dodgerblue3,dodgerblue4,steelblue1,steelblue2,
0066: * steelblue3,steelblue4,deepskyblue1,deepskyblue2,deepskyblue3,deepskyblue4,
0067: * skyblue1,skyblue2,skyblue3,skyblue4,lightskyblue1,lightskyblue2,lightskyblue3,
0068: * lightskyblue4,slategray1,slategray2,slategray3,slategray4,lightsteelblue1,
0069: * lightsteelblue2,lightsteelblue3,lightsteelblue4,lightblue1,lightblue2,
0070: * lightblue3,lightblue4,lightcyan1,lightcyan2,lightcyan3,lightcyan4,
0071: * paleturquoise1,paleturquoise2,paleturquoise3,paleturquoise4,cadetblue1,
0072: * cadetblue2,cadetblue3,cadetblue4,turquoise1,turquoise2,turquoise3,
0073: * turquoise4,cyan1,cyan2,cyan3,cyan4,darkslategray1,darkslategray2,
0074: * darkslategray3,darkslategray4,aquamarine1,aquamarine2,aquamarine3,
0075: * aquamarine4,darkseagreen1,darkseagreen2,darkseagreen3,darkseagreen4,
0076: * seagreen1,seagreen2,seagreen3,seagreen4,palegreen1,palegreen2,palegreen3,
0077: * palegreen4,springgreen1,springgreen2,springgreen3,springgreen4,green1,
0078: * green2,green3,green4,chartreuse1,chartreuse2,chartreuse3,chartreuse4,
0079: * olivedrab1,olivedrab2,olivedrab3,olivedrab4,darkolivegreen1,darkolivegreen2,
0080: * darkolivegreen3,darkolivegreen4,khaki1,khaki2,khaki3,khaki4,lightgoldenrod1,
0081: * lightgoldenrod2,lightgoldenrod3,lightgoldenrod4,lightyellow1,lightyellow2,
0082: * lightyellow3,lightyellow4,yellow1,yellow2,yellow3,yellow4,gold1,
0083: * gold2,gold3,gold4,goldenrod1,goldenrod2,goldenrod3,goldenrod4,darkgoldenrod1,
0084: * darkgoldenrod2,darkgoldenrod3,darkgoldenrod4,rosybrown1,rosybrown2,rosybrown3,
0085: * rosybrown4,indianred1,indianred2,indianred3,indianred4,sienna1,sienna2,
0086: * sienna3,sienna4,burlywood1,burlywood2,burlywood3,burlywood4,wheat1,
0087: * wheat2,wheat3,wheat4,tan1,tan2,tan3,tan4,chocolate1,chocolate2,chocolate3,
0088: * chocolate4,firebrick1,firebrick2,firebrick3,firebrick4,brown1,brown2,
0089: * brown3,brown4,salmon1,salmon2,salmon3,salmon4,lightsalmon1,lightsalmon2,
0090: * lightsalmon3,lightsalmon4,orange1,orange2,orange3,orange4,darkorange1,
0091: * darkorange2,darkorange3,darkorange4,coral1,coral2,coral3,coral4,
0092: * tomato1,tomato2,tomato3,tomato4,orangered1,orangered2,orangered3,
0093: * orangered4,red1,red2,red3,red4,deeppink1,deeppink2,deeppink3,deeppink4,
0094: * hotpink1,hotpink2,hotpink3,hotpink4,pink1,pink2,pink3,pink4,lightpink1,
0095: * lightpink2,lightpink3,lightpink4,palevioletred1,palevioletred2,palevioletred3,
0096: * palevioletred4,maroon1,maroon2,maroon3,maroon4,violetred1,violetred2,
0097: * violetred3,violetred4,magenta1,magenta2,magenta3,magenta4,orchid1,
0098: * orchid2,orchid3,orchid4,plum1,plum2,plum3,plum4,mediumorchid1,mediumorchid2,
0099: * mediumorchid3,mediumorchid4,darkorchid1,darkorchid2,darkorchid3,darkorchid4,
0100: * purple1,purple2,purple3,purple4,mediumpurple1,mediumpurple2,mediumpurple3,
0101: * mediumpurple4,thistle1,thistle2,thistle3,thistle4,gray0,grey0,gray1,
0102: * grey1,gray2,grey2,gray3,grey3,gray4,grey4,gray5,grey5,gray6,grey6,
0103: * gray7,grey7,gray8,grey8,gray9,grey9,gray10,grey10,gray11,grey11,gray12,
0104: * grey12,gray13,grey13,gray14,grey14,gray15,grey15,gray16,grey16,gray17,
0105: * grey17,gray18,grey18,gray19,grey19,gray20,grey20,gray21,grey21,gray22,
0106: * grey22,gray23,grey23,gray24,grey24,gray25,grey25,gray26,grey26,gray27,
0107: * grey27,gray28,grey28,gray29,grey29,gray30,grey30,gray31,grey31,gray32,
0108: * grey32,gray33,grey33,gray34,grey34,gray35,grey35,gray36,grey36,gray37,
0109: * grey37,gray38,grey38,gray39,grey39,gray40,grey40,gray41,grey41,gray42,
0110: * grey42,gray43,grey43,gray44,grey44,gray45,grey45,gray46,grey46,gray47,
0111: * grey47,gray48,grey48,gray49,grey49,gray50,grey50,gray51,grey51,gray52,
0112: * grey52,gray53,grey53,gray54,grey54,gray55,grey55,gray56,grey56,gray57,
0113: * grey57,gray58,grey58,gray59,grey59,gray60,grey60,gray61,grey61,gray62,
0114: * grey62,gray63,grey63,gray64,grey64,gray65,grey65,gray66,grey66,gray67,
0115: * grey67,gray68,grey68,gray69,grey69,gray70,grey70,gray71,grey71,gray72,
0116: * grey72,gray73,grey73,gray74,grey74,gray75,grey75,gray76,grey76,gray77,
0117: * grey77,gray78,grey78,gray79,grey79,gray80,grey80,gray81,grey81,gray82,
0118: * grey82,gray83,grey83,gray84,grey84,gray85,grey85,gray86,grey86,gray87,
0119: * grey87,gray88,grey88,gray89,grey89,gray90,grey90,gray91,grey91,gray92,
0120: * grey92,gray93,grey93,gray94,grey94,gray95,grey95,gray96,grey96,gray97,
0121: * grey97,gray98,grey98,gray99,grey99,gray100,grey100,dark grey,darkgrey,
0122: * dark gray,darkgray,dark blue,darkblue,dark cyan,darkcyan,dark magenta,
0123: * darkmagenta,dark red,darkred,light
0124: * <P>
0125: * @author Robin Sharp
0126: */
0127:
0128: public class SColor {
0129: public static final double FACTOR = 0.7;
0130:
0131: /**
0132: * Creates a SColor with the specified red, green, blue.
0133: */
0134: public SColor(int r, int g, int b) {
0135: this (r, g, b, 255);
0136: }
0137:
0138: /**
0139: * Creates a SColor with the specified red, green, blue, and alpha.
0140: */
0141: public SColor(int r, int g, int b, int a) {
0142: value = ((a & 0xFF) << 24) | ((r & 0xFF) << 16)
0143: | ((g & 0xFF) << 8) | ((b & 0xFF) << 0);
0144: }
0145:
0146: /**
0147: * Create a SColor from the specified rgb value
0148: */
0149: public SColor(int rgb) {
0150: value = 0xff000000 | rgb;
0151: }
0152:
0153: /**
0154: * Returns the red component.
0155: */
0156: public int getRed() {
0157: return (getRGB() >> 16) & 0xFF;
0158: }
0159:
0160: /**
0161: * Returns the green component.
0162: */
0163: public int getGreen() {
0164: return (getRGB() >> 8) & 0xFF;
0165: }
0166:
0167: /**
0168: * Returns the blue component.
0169: */
0170: public int getBlue() {
0171: return (getRGB() >> 0) & 0xFF;
0172: }
0173:
0174: /**
0175: * Returns the alpha component.
0176: */
0177: public int getAlpha() {
0178: return (getRGB() >> 24) & 0xff;
0179: }
0180:
0181: /**
0182: * Returns the RGB value.
0183: */
0184: public int getRGB() {
0185: return value;
0186: }
0187:
0188: /**
0189: * Inverse the color, and cache it.
0190: */
0191: public static SColor toInverse(SColor color) {
0192: SColor inverse = (SColor) inverseColors.get(color);
0193: if (inverse != null)
0194: return inverse;
0195:
0196: inverse = getColor("#" + toInverseHexString(color));
0197: inverseColors.put(color, inverse);
0198:
0199: return inverse;
0200: }
0201:
0202: /**
0203: * If the color is < 125 then brighten, else darken.
0204: * and cache it.
0205: */
0206: public static String toInverseHexString(SColor color) {
0207: String string = (String) inverseHexStrings.get(color);
0208: if (string != null)
0209: return string;
0210:
0211: int r = color.getRed();
0212: int g = color.getGreen();
0213: int b = color.getBlue();
0214:
0215: if (color.getRGB() < 125) //BRIGHTER
0216: {
0217: int i = (int) (1.0 / (1.0 - FACTOR));
0218: if (!(r == 0 && g == 0 && b == 0)) {
0219: if (r > 0 && r < i)
0220: r = i;
0221: if (g > 0 && g < i)
0222: g = i;
0223: if (b > 0 && b < i)
0224: b = i;
0225:
0226: r = Math.min((int) (r / FACTOR), 255);
0227: g = Math.min((int) (g / FACTOR), 255);
0228: b = Math.min((int) (b / FACTOR), 255);
0229: } else {
0230: r = i;
0231: g = i;
0232: b = i;
0233: }
0234: } else //DARKER
0235: {
0236: r = Math.max((int) (r * FACTOR), 0);
0237: g = Math.max((int) (g * FACTOR), 0);
0238: b = Math.max((int) (b * FACTOR), 0);
0239: }
0240:
0241: StringBuffer buf = new StringBuffer(6);
0242:
0243: if (r < 8)
0244: buf.append("0");
0245: buf.append(Integer.toHexString(r));
0246:
0247: if (g < 8)
0248: buf.append("0");
0249: buf.append(Integer.toHexString(g));
0250:
0251: if (b < 8)
0252: buf.append("0");
0253: buf.append(Integer.toHexString(b));
0254:
0255: inverseHexStrings.put(color, buf.toString());
0256:
0257: return buf.toString();
0258: }
0259:
0260: /**
0261: * Get the hex string, and cache it.
0262: */
0263: public static String toHexString(SColor color) {
0264: String string = (String) hexStrings.get(color);
0265:
0266: if (string != null)
0267: return string;
0268:
0269: StringBuffer buf = new StringBuffer(6);
0270:
0271: if (color.getRed() < 8)
0272: buf.append("0");
0273: buf.append(Integer.toHexString(color.getRed()));
0274:
0275: if (color.getGreen() < 8)
0276: buf.append("0");
0277: buf.append(Integer.toHexString(color.getGreen()));
0278:
0279: if (color.getBlue() < 8)
0280: buf.append("0");
0281: buf.append(Integer.toHexString(color.getBlue()));
0282:
0283: hexStrings.put(color, buf.toString());
0284:
0285: return buf.toString();
0286: }
0287:
0288: /**
0289: * Get the brighter hex string, and cache it.
0290: */
0291: public static String toBrighterHexString(SColor color) {
0292: String string = (String) brighterHexStrings.get(color);
0293: if (string != null)
0294: return string;
0295:
0296: string = toHexString(color.brighter());
0297:
0298: brighterHexStrings.put(color, string);
0299:
0300: return string;
0301: }
0302:
0303: /**
0304: * Get the darker hex string, and cache it.
0305: */
0306: public static String toDarkerHexString(SColor color) {
0307: String string = (String) darkerHexStrings.get(color);
0308: if (string != null)
0309: return string;
0310:
0311: string = toHexString(color.darker());
0312:
0313: darkerHexStrings.put(color, string);
0314:
0315: return string;
0316: }
0317:
0318: public SColor brighter() {
0319: int r = getRed();
0320: int g = getGreen();
0321: int b = getBlue();
0322:
0323: /* From 2D group:
0324: * 1. black.brighter() should return grey
0325: * 2. applying brighter to blue will always return blue, brighter
0326: * 3. non pure color (non zero rgb) will eventually return white
0327: */
0328: int i = (int) (1.0 / (1.0 - FACTOR));
0329: if (r == 0 && g == 0 && b == 0) {
0330: return new SColor(i, i, i);
0331: }
0332: if (r > 0 && r < i)
0333: r = i;
0334: if (g > 0 && g < i)
0335: g = i;
0336: if (b > 0 && b < i)
0337: b = i;
0338:
0339: return new SColor(Math.min((int) (r / FACTOR), 255), Math.min(
0340: (int) (g / FACTOR), 255), Math.min((int) (b / FACTOR),
0341: 255));
0342: }
0343:
0344: /**
0345: */
0346: public SColor darker() {
0347: return new SColor(Math.max((int) (getRed() * FACTOR), 0), Math
0348: .max((int) (getGreen() * FACTOR), 0), Math.max(
0349: (int) (getBlue() * FACTOR), 0));
0350: }
0351:
0352: /**
0353: */
0354: public int hashCode() {
0355: return value;
0356: }
0357:
0358: /**
0359: * Determines whether another object is equal to this color.
0360: */
0361: public boolean equals(Object obj) {
0362: return obj instanceof SColor
0363: && ((SColor) obj).value == this .value;
0364: }
0365:
0366: /**
0367: */
0368: public String toString() {
0369: return getClass().getName() + "[r=" + getRed() + ",g="
0370: + getGreen() + ",b=" + getBlue() + "]";
0371: }
0372:
0373: /**
0374: * Turns a string into a SColor
0375: * For example "#00ff00" will return SColor.green
0376: * and "snow" will return SColor(255, 250, 250)
0377: * For a full list of standard colours look in SColor.java
0378: * @return a SColor for a string. A null or non-sensical string will return null
0379: */
0380: static public SColor getColor(String colorString) {
0381: if (colorString == null) {
0382: return null;
0383: }
0384:
0385: if (colorString.startsWith("#")) {
0386: try {
0387: return new SColor(Integer.parseInt(colorString
0388: .substring(1), 16));
0389: } catch (NumberFormatException nfe) {
0390: return null;
0391: }
0392: }
0393:
0394: return (SColor) colors.get(colorString.toLowerCase());
0395: }
0396:
0397: /**
0398: * Add a color by name. If the color is null it is removed.
0399: */
0400: static public void addColor(String name, SColor color) {
0401: if (color == null) {
0402: colors.remove(name);
0403: } else {
0404: colors.put(name.toLowerCase(), color);
0405: }
0406: }
0407:
0408: /**
0409: * Get the closest named color
0410: */
0411: static public String match(SColor color) {
0412: for (int index = 0; index < 100; index++) {
0413: for (int colorIndex = 0; colorIndex < colorArray.length; colorIndex++) {
0414: if (color.getBlue() > ((SColor) colorArray[colorIndex][1])
0415: .getBlue()
0416: - index
0417: && color.getBlue() < ((SColor) colorArray[colorIndex][1])
0418: .getBlue()
0419: + index
0420: && color.getRed() > ((SColor) colorArray[colorIndex][1])
0421: .getRed()
0422: - index
0423: && color.getRed() < ((SColor) colorArray[colorIndex][1])
0424: .getRed()
0425: + index
0426: && color.getGreen() > ((SColor) colorArray[colorIndex][1])
0427: .getGreen()
0428: - index
0429: && color.getGreen() < ((SColor) colorArray[colorIndex][1])
0430: .getGreen()
0431: + index) {
0432: System.out.println(color);
0433: System.out
0434: .println(((SColor) colorArray[colorIndex][1]));
0435: return colorArray[colorIndex][0].toString();
0436: }
0437:
0438: }
0439: }
0440:
0441: return null;
0442: }
0443:
0444: static final Object colorArray[][] = {
0445: { "snow", new SColor(255, 250, 250) },
0446: { "ghost white", new SColor(248, 248, 255) },
0447: { "ghostwhite", new SColor(248, 248, 255) },
0448: { "white smoke", new SColor(245, 245, 245) },
0449: { "whitesmoke", new SColor(245, 245, 245) },
0450: { "gainsboro", new SColor(220, 220, 220) },
0451: { "floral white", new SColor(255, 250, 240) },
0452: { "floralwhite", new SColor(255, 250, 240) },
0453: { "old lace", new SColor(253, 245, 230) },
0454: { "oldlace", new SColor(253, 245, 230) },
0455: { "linen", new SColor(250, 240, 230) },
0456: { "antique white", new SColor(250, 235, 215) },
0457: { "antiquewhite", new SColor(250, 235, 215) },
0458: { "papaya whip", new SColor(255, 239, 213) },
0459: { "papayawhip", new SColor(255, 239, 213) },
0460: { "blanched almond", new SColor(255, 235, 205) },
0461: { "blanchedalmond", new SColor(255, 235, 205) },
0462: { "bisque", new SColor(255, 228, 196) },
0463: { "peach puff", new SColor(255, 218, 185) },
0464: { "peachpuff", new SColor(255, 218, 185) },
0465: { "navajo white", new SColor(255, 222, 173) },
0466: { "navajowhite", new SColor(255, 222, 173) },
0467: { "moccasin", new SColor(255, 228, 181) },
0468: { "cornsilk", new SColor(255, 248, 220) },
0469: { "ivory", new SColor(255, 255, 240) },
0470: { "lemon chiffon", new SColor(255, 250, 205) },
0471: { "lemonchiffon", new SColor(255, 250, 205) },
0472: { "seashell", new SColor(255, 245, 238) },
0473: { "honeydew", new SColor(240, 255, 240) },
0474: { "mint cream", new SColor(245, 255, 250) },
0475: { "mintcream", new SColor(245, 255, 250) },
0476: { "azure", new SColor(240, 255, 255) },
0477: { "alice blue", new SColor(240, 248, 255) },
0478: { "aliceblue", new SColor(240, 248, 255) },
0479: { "lavender", new SColor(230, 230, 250) },
0480: { "lavender blush", new SColor(255, 240, 245) },
0481: { "lavenderblush", new SColor(255, 240, 245) },
0482: { "misty rose", new SColor(255, 228, 225) },
0483: { "mistyrose", new SColor(255, 228, 225) },
0484: { "white", new SColor(255, 255, 255) },
0485: { "black", new SColor(0, 0, 0) },
0486: { "dark slate gray", new SColor(47, 79, 79) },
0487: { "darkslategray", new SColor(47, 79, 79) },
0488: { "dark slate grey", new SColor(47, 79, 79) },
0489: { "darkslategrey", new SColor(47, 79, 79) },
0490: { "dim gray", new SColor(105, 105, 105) },
0491: { "dimgray", new SColor(105, 105, 105) },
0492: { "dim grey", new SColor(105, 105, 105) },
0493: { "dimgrey", new SColor(105, 105, 105) },
0494: { "slate gray", new SColor(112, 128, 144) },
0495: { "slategray", new SColor(112, 128, 144) },
0496: { "slate grey", new SColor(112, 128, 144) },
0497: { "slategrey", new SColor(112, 128, 144) },
0498: { "light slate gray", new SColor(119, 136, 153) },
0499: { "lightslategray", new SColor(119, 136, 153) },
0500: { "light slate grey", new SColor(119, 136, 153) },
0501: { "lightslategrey", new SColor(119, 136, 153) },
0502: { "gray", new SColor(190, 190, 190) },
0503: { "grey", new SColor(190, 190, 190) },
0504: { "light grey", new SColor(211, 211, 211) },
0505: { "lightgrey", new SColor(211, 211, 211) },
0506: { "light gray", new SColor(211, 211, 211) },
0507: { "lightgray", new SColor(211, 211, 211) },
0508: { "midnight blue", new SColor(25, 25, 112) },
0509: { "midnightblue", new SColor(25, 25, 112) },
0510: { "navy", new SColor(0, 0, 128) },
0511: { "navy blue", new SColor(0, 0, 128) },
0512: { "navyblue", new SColor(0, 0, 128) },
0513: { "cornflower blue", new SColor(100, 149, 237) },
0514: { "cornflowerblue", new SColor(100, 149, 237) },
0515: { "dark slate blue", new SColor(72, 61, 139) },
0516: { "darkslateblue", new SColor(72, 61, 139) },
0517: { "slate blue", new SColor(106, 90, 205) },
0518: { "slateblue", new SColor(106, 90, 205) },
0519: { "medium slate blue", new SColor(123, 104, 238) },
0520: { "mediumslateblue", new SColor(123, 104, 238) },
0521: { "light slate blue", new SColor(132, 112, 255) },
0522: { "lightslateblue", new SColor(132, 112, 255) },
0523: { "medium blue", new SColor(0, 0, 205) },
0524: { "mediumblue", new SColor(0, 0, 205) },
0525: { "royal blue", new SColor(65, 105, 225) },
0526: { "royalblue", new SColor(65, 105, 225) },
0527: { "blue", new SColor(0, 0, 255) },
0528: { "dodger blue", new SColor(30, 144, 255) },
0529: { "dodgerblue", new SColor(30, 144, 255) },
0530: { "deep sky blue", new SColor(0, 191, 255) },
0531: { "deepskyblue", new SColor(0, 191, 255) },
0532: { "sky blue", new SColor(135, 206, 235) },
0533: { "skyblue", new SColor(135, 206, 235) },
0534: { "light sky blue", new SColor(135, 206, 250) },
0535: { "lightskyblue", new SColor(135, 206, 250) },
0536: { "steel blue", new SColor(70, 130, 180) },
0537: { "steelblue", new SColor(70, 130, 180) },
0538: { "light steel blue", new SColor(176, 196, 222) },
0539: { "lightsteelblue", new SColor(176, 196, 222) },
0540: { "light blue", new SColor(173, 216, 230) },
0541: { "lightblue", new SColor(173, 216, 230) },
0542: { "powder blue", new SColor(176, 224, 230) },
0543: { "powderblue", new SColor(176, 224, 230) },
0544: { "pale turquoise", new SColor(175, 238, 238) },
0545: { "paleturquoise", new SColor(175, 238, 238) },
0546: { "dark turquoise", new SColor(0, 206, 209) },
0547: { "darkturquoise", new SColor(0, 206, 209) },
0548: { "medium turquoise", new SColor(72, 209, 204) },
0549: { "mediumturquoise", new SColor(72, 209, 204) },
0550: { "turquoise", new SColor(64, 224, 208) },
0551: { "cyan", new SColor(0, 255, 255) },
0552: { "light cyan", new SColor(224, 255, 255) },
0553: { "lightcyan", new SColor(224, 255, 255) },
0554: { "cadet blue", new SColor(95, 158, 160) },
0555: { "cadetblue", new SColor(95, 158, 160) },
0556: { "medium aquamarine", new SColor(102, 205, 170) },
0557: { "mediumaquamarine", new SColor(102, 205, 170) },
0558: { "aquamarine", new SColor(127, 255, 212) },
0559: { "dark green", new SColor(0, 100, 0) },
0560: { "darkgreen", new SColor(0, 100, 0) },
0561: { "dark olive green", new SColor(85, 107, 47) },
0562: { "darkolivegreen", new SColor(85, 107, 47) },
0563: { "dark sea green", new SColor(143, 188, 143) },
0564: { "darkseagreen", new SColor(143, 188, 143) },
0565: { "sea green", new SColor(46, 139, 87) },
0566: { "seagreen", new SColor(46, 139, 87) },
0567: { "medium sea green", new SColor(60, 179, 113) },
0568: { "mediumseagreen", new SColor(60, 179, 113) },
0569: { "light sea green", new SColor(32, 178, 170) },
0570: { "lightseagreen", new SColor(32, 178, 170) },
0571: { "pale green", new SColor(152, 251, 152) },
0572: { "palegreen", new SColor(152, 251, 152) },
0573: { "spring green", new SColor(0, 255, 127) },
0574: { "springgreen", new SColor(0, 255, 127) },
0575: { "lawn green", new SColor(124, 252, 0) },
0576: { "lawngreen", new SColor(124, 252, 0) },
0577: { "green", new SColor(0, 255, 0) },
0578: { "chartreuse", new SColor(127, 255, 0) },
0579: { "medium spring green", new SColor(0, 250, 154) },
0580: { "mediumspringgreen", new SColor(0, 250, 154) },
0581: { "green yellow", new SColor(173, 255, 47) },
0582: { "greenyellow", new SColor(173, 255, 47) },
0583: { "lime green", new SColor(50, 205, 50) },
0584: { "limegreen", new SColor(50, 205, 50) },
0585: { "yellow green", new SColor(154, 205, 50) },
0586: { "yellowgreen", new SColor(154, 205, 50) },
0587: { "forest green", new SColor(34, 139, 34) },
0588: { "forestgreen", new SColor(34, 139, 34) },
0589: { "olive drab", new SColor(107, 142, 35) },
0590: { "olivedrab", new SColor(107, 142, 35) },
0591: { "dark khaki", new SColor(189, 183, 107) },
0592: { "darkkhaki", new SColor(189, 183, 107) },
0593: { "khaki", new SColor(240, 230, 140) },
0594: { "pale goldenrod", new SColor(238, 232, 170) },
0595: { "palegoldenrod", new SColor(238, 232, 170) },
0596: { "light goldenrod yellow", new SColor(250, 250, 210) },
0597: { "lightgoldenrodyellow", new SColor(250, 250, 210) },
0598: { "light yellow", new SColor(255, 255, 224) },
0599: { "lightyellow", new SColor(255, 255, 224) },
0600: { "yellow", new SColor(255, 255, 0) },
0601: { "gold", new SColor(255, 215, 0) },
0602: { "light goldenrod", new SColor(238, 221, 130) },
0603: { "lightgoldenrod", new SColor(238, 221, 130) },
0604: { "goldenrod", new SColor(218, 165, 32) },
0605: { "dark goldenrod", new SColor(184, 134, 11) },
0606: { "darkgoldenrod", new SColor(184, 134, 11) },
0607: { "rosy brown", new SColor(188, 143, 143) },
0608: { "rosybrown", new SColor(188, 143, 143) },
0609: { "indian red", new SColor(205, 92, 92) },
0610: { "indianred", new SColor(205, 92, 92) },
0611: { "saddle brown", new SColor(139, 69, 19) },
0612: { "saddlebrown", new SColor(139, 69, 19) },
0613: { "sienna", new SColor(160, 82, 45) },
0614: { "peru", new SColor(205, 133, 63) },
0615: { "burlywood", new SColor(222, 184, 135) },
0616: { "beige", new SColor(245, 245, 220) },
0617: { "wheat", new SColor(245, 222, 179) },
0618: { "sandy brown", new SColor(244, 164, 96) },
0619: { "sandybrown", new SColor(244, 164, 96) },
0620: { "tan", new SColor(210, 180, 140) },
0621: { "chocolate", new SColor(210, 105, 30) },
0622: { "firebrick", new SColor(178, 34, 34) },
0623: { "brown", new SColor(165, 42, 42) },
0624: { "dark salmon", new SColor(233, 150, 122) },
0625: { "darksalmon", new SColor(233, 150, 122) },
0626: { "salmon", new SColor(250, 128, 114) },
0627: { "light salmon", new SColor(255, 160, 122) },
0628: { "lightsalmon", new SColor(255, 160, 122) },
0629: { "orange", new SColor(255, 165, 0) },
0630: { "dark orange", new SColor(255, 140, 0) },
0631: { "darkorange", new SColor(255, 140, 0) },
0632: { "coral", new SColor(255, 127, 80) },
0633: { "light coral", new SColor(240, 128, 128) },
0634: { "lightcoral", new SColor(240, 128, 128) },
0635: { "tomato", new SColor(255, 99, 71) },
0636: { "orange red", new SColor(255, 69, 0) },
0637: { "orangered", new SColor(255, 69, 0) },
0638: { "red", new SColor(255, 0, 0) },
0639: { "hot pink", new SColor(255, 105, 180) },
0640: { "hotpink", new SColor(255, 105, 180) },
0641: { "deep pink", new SColor(255, 20, 147) },
0642: { "deeppink", new SColor(255, 20, 147) },
0643: { "pink", new SColor(255, 192, 203) },
0644: { "light pink", new SColor(255, 182, 193) },
0645: { "lightpink", new SColor(255, 182, 193) },
0646: { "pale violet red", new SColor(219, 112, 147) },
0647: { "palevioletred", new SColor(219, 112, 147) },
0648: { "maroon", new SColor(176, 48, 96) },
0649: { "medium violet red", new SColor(199, 21, 133) },
0650: { "mediumvioletred", new SColor(199, 21, 133) },
0651: { "violet red", new SColor(208, 32, 144) },
0652: { "violetred", new SColor(208, 32, 144) },
0653: { "magenta", new SColor(255, 0, 255) },
0654: { "violet", new SColor(238, 130, 238) },
0655: { "plum", new SColor(221, 160, 221) },
0656: { "orchid", new SColor(218, 112, 214) },
0657: { "medium orchid", new SColor(186, 85, 211) },
0658: { "mediumorchid", new SColor(186, 85, 211) },
0659: { "dark orchid", new SColor(153, 50, 204) },
0660: { "darkorchid", new SColor(153, 50, 204) },
0661: { "dark violet", new SColor(148, 0, 211) },
0662: { "darkviolet", new SColor(148, 0, 211) },
0663: { "blue violet", new SColor(138, 43, 226) },
0664: { "blueviolet", new SColor(138, 43, 226) },
0665: { "purple", new SColor(160, 32, 240) },
0666: { "medium purple", new SColor(147, 112, 219) },
0667: { "mediumpurple", new SColor(147, 112, 219) },
0668: { "thistle", new SColor(216, 191, 216) },
0669: { "snow1", new SColor(255, 250, 250) },
0670: { "snow2", new SColor(238, 233, 233) },
0671: { "snow3", new SColor(205, 201, 201) },
0672: { "snow4", new SColor(139, 137, 137) },
0673: { "seashell1", new SColor(255, 245, 238) },
0674: { "seashell2", new SColor(238, 229, 222) },
0675: { "seashell3", new SColor(205, 197, 191) },
0676: { "seashell4", new SColor(139, 134, 130) },
0677: { "antiquewhite1", new SColor(255, 239, 219) },
0678: { "antiquewhite2", new SColor(238, 223, 204) },
0679: { "antiquewhite3", new SColor(205, 192, 176) },
0680: { "antiquewhite4", new SColor(139, 131, 120) },
0681: { "bisque1", new SColor(255, 228, 196) },
0682: { "bisque2", new SColor(238, 213, 183) },
0683: { "bisque3", new SColor(205, 183, 158) },
0684: { "bisque4", new SColor(139, 125, 107) },
0685: { "peachpuff1", new SColor(255, 218, 185) },
0686: { "peachpuff2", new SColor(238, 203, 173) },
0687: { "peachpuff3", new SColor(205, 175, 149) },
0688: { "peachpuff4", new SColor(139, 119, 101) },
0689: { "navajowhite1", new SColor(255, 222, 173) },
0690: { "navajowhite2", new SColor(238, 207, 161) },
0691: { "navajowhite3", new SColor(205, 179, 139) },
0692: { "navajowhite4", new SColor(139, 121, 94) },
0693: { "lemonchiffon1", new SColor(255, 250, 205) },
0694: { "lemonchiffon2", new SColor(238, 233, 191) },
0695: { "lemonchiffon3", new SColor(205, 201, 165) },
0696: { "lemonchiffon4", new SColor(139, 137, 112) },
0697: { "cornsilk1", new SColor(255, 248, 220) },
0698: { "cornsilk2", new SColor(238, 232, 205) },
0699: { "cornsilk3", new SColor(205, 200, 177) },
0700: { "cornsilk4", new SColor(139, 136, 120) },
0701: { "ivory1", new SColor(255, 255, 240) },
0702: { "ivory2", new SColor(238, 238, 224) },
0703: { "ivory3", new SColor(205, 205, 193) },
0704: { "ivory4", new SColor(139, 139, 131) },
0705: { "honeydew1", new SColor(240, 255, 240) },
0706: { "honeydew2", new SColor(224, 238, 224) },
0707: { "honeydew3", new SColor(193, 205, 193) },
0708: { "honeydew4", new SColor(131, 139, 131) },
0709: { "lavenderblush1", new SColor(255, 240, 245) },
0710: { "lavenderblush2", new SColor(238, 224, 229) },
0711: { "lavenderblush3", new SColor(205, 193, 197) },
0712: { "lavenderblush4", new SColor(139, 131, 134) },
0713: { "mistyrose1", new SColor(255, 228, 225) },
0714: { "mistyrose2", new SColor(238, 213, 210) },
0715: { "mistyrose3", new SColor(205, 183, 181) },
0716: { "mistyrose4", new SColor(139, 125, 123) },
0717: { "azure1", new SColor(240, 255, 255) },
0718: { "azure2", new SColor(224, 238, 238) },
0719: { "azure3", new SColor(193, 205, 205) },
0720: { "azure4", new SColor(131, 139, 139) },
0721: { "slateblue1", new SColor(131, 111, 255) },
0722: { "slateblue2", new SColor(122, 103, 238) },
0723: { "slateblue3", new SColor(105, 89, 205) },
0724: { "slateblue4", new SColor(71, 60, 139) },
0725: { "royalblue1", new SColor(72, 118, 255) },
0726: { "royalblue2", new SColor(67, 110, 238) },
0727: { "royalblue3", new SColor(58, 95, 205) },
0728: { "royalblue4", new SColor(39, 64, 139) },
0729: { "blue1", new SColor(0, 0, 255) },
0730: { "blue2", new SColor(0, 0, 238) },
0731: { "blue3", new SColor(0, 0, 205) },
0732: { "blue4", new SColor(0, 0, 139) },
0733: { "dodgerblue1", new SColor(30, 144, 255) },
0734: { "dodgerblue2", new SColor(28, 134, 238) },
0735: { "dodgerblue3", new SColor(24, 116, 205) },
0736: { "dodgerblue4", new SColor(16, 78, 139) },
0737: { "steelblue1", new SColor(99, 184, 255) },
0738: { "steelblue2", new SColor(92, 172, 238) },
0739: { "steelblue3", new SColor(79, 148, 205) },
0740: { "steelblue4", new SColor(54, 100, 139) },
0741: { "deepskyblue1", new SColor(0, 191, 255) },
0742: { "deepskyblue2", new SColor(0, 178, 238) },
0743: { "deepskyblue3", new SColor(0, 154, 205) },
0744: { "deepskyblue4", new SColor(0, 104, 139) },
0745: { "skyblue1", new SColor(135, 206, 255) },
0746: { "skyblue2", new SColor(126, 192, 238) },
0747: { "skyblue3", new SColor(108, 166, 205) },
0748: { "skyblue4", new SColor(74, 112, 139) },
0749: { "lightskyblue1", new SColor(176, 226, 255) },
0750: { "lightskyblue2", new SColor(164, 211, 238) },
0751: { "lightskyblue3", new SColor(141, 182, 205) },
0752: { "lightskyblue4", new SColor(96, 123, 139) },
0753: { "slategray1", new SColor(198, 226, 255) },
0754: { "slategray2", new SColor(185, 211, 238) },
0755: { "slategray3", new SColor(159, 182, 205) },
0756: { "slategray4", new SColor(108, 123, 139) },
0757: { "lightsteelblue1", new SColor(202, 225, 255) },
0758: { "lightsteelblue2", new SColor(188, 210, 238) },
0759: { "lightsteelblue3", new SColor(162, 181, 205) },
0760: { "lightsteelblue4", new SColor(110, 123, 139) },
0761: { "lightblue1", new SColor(191, 239, 255) },
0762: { "lightblue2", new SColor(178, 223, 238) },
0763: { "lightblue3", new SColor(154, 192, 205) },
0764: { "lightblue4", new SColor(104, 131, 139) },
0765: { "lightcyan1", new SColor(224, 255, 255) },
0766: { "lightcyan2", new SColor(209, 238, 238) },
0767: { "lightcyan3", new SColor(180, 205, 205) },
0768: { "lightcyan4", new SColor(122, 139, 139) },
0769: { "paleturquoise1", new SColor(187, 255, 255) },
0770: { "paleturquoise2", new SColor(174, 238, 238) },
0771: { "paleturquoise3", new SColor(150, 205, 205) },
0772: { "paleturquoise4", new SColor(102, 139, 139) },
0773: { "cadetblue1", new SColor(152, 245, 255) },
0774: { "cadetblue2", new SColor(142, 229, 238) },
0775: { "cadetblue3", new SColor(122, 197, 205) },
0776: { "cadetblue4", new SColor(83, 134, 139) },
0777: { "turquoise1", new SColor(0, 245, 255) },
0778: { "turquoise2", new SColor(0, 229, 238) },
0779: { "turquoise3", new SColor(0, 197, 205) },
0780: { "turquoise4", new SColor(0, 134, 139) },
0781: { "cyan1", new SColor(0, 255, 255) },
0782: { "cyan2", new SColor(0, 238, 238) },
0783: { "cyan3", new SColor(0, 205, 205) },
0784: { "cyan4", new SColor(0, 139, 139) },
0785: { "darkslategray1", new SColor(151, 255, 255) },
0786: { "darkslategray2", new SColor(141, 238, 238) },
0787: { "darkslategray3", new SColor(121, 205, 205) },
0788: { "darkslategray4", new SColor(82, 139, 139) },
0789: { "aquamarine1", new SColor(127, 255, 212) },
0790: { "aquamarine2", new SColor(118, 238, 198) },
0791: { "aquamarine3", new SColor(102, 205, 170) },
0792: { "aquamarine4", new SColor(69, 139, 116) },
0793: { "darkseagreen1", new SColor(193, 255, 193) },
0794: { "darkseagreen2", new SColor(180, 238, 180) },
0795: { "darkseagreen3", new SColor(155, 205, 155) },
0796: { "darkseagreen4", new SColor(105, 139, 105) },
0797: { "seagreen1", new SColor(84, 255, 159) },
0798: { "seagreen2", new SColor(78, 238, 148) },
0799: { "seagreen3", new SColor(67, 205, 128) },
0800: { "seagreen4", new SColor(46, 139, 87) },
0801: { "palegreen1", new SColor(154, 255, 154) },
0802: { "palegreen2", new SColor(144, 238, 144) },
0803: { "palegreen3", new SColor(124, 205, 124) },
0804: { "palegreen4", new SColor(84, 139, 84) },
0805: { "springgreen1", new SColor(0, 255, 127) },
0806: { "springgreen2", new SColor(0, 238, 118) },
0807: { "springgreen3", new SColor(0, 205, 102) },
0808: { "springgreen4", new SColor(0, 139, 69) },
0809: { "green1", new SColor(0, 255, 0) },
0810: { "green2", new SColor(0, 238, 0) },
0811: { "green3", new SColor(0, 205, 0) },
0812: { "green4", new SColor(0, 139, 0) },
0813: { "chartreuse1", new SColor(127, 255, 0) },
0814: { "chartreuse2", new SColor(118, 238, 0) },
0815: { "chartreuse3", new SColor(102, 205, 0) },
0816: { "chartreuse4", new SColor(69, 139, 0) },
0817: { "olivedrab1", new SColor(192, 255, 62) },
0818: { "olivedrab2", new SColor(179, 238, 58) },
0819: { "olivedrab3", new SColor(154, 205, 50) },
0820: { "olivedrab4", new SColor(105, 139, 34) },
0821: { "darkolivegreen1", new SColor(202, 255, 112) },
0822: { "darkolivegreen2", new SColor(188, 238, 104) },
0823: { "darkolivegreen3", new SColor(162, 205, 90) },
0824: { "darkolivegreen4", new SColor(110, 139, 61) },
0825: { "khaki1", new SColor(255, 246, 143) },
0826: { "khaki2", new SColor(238, 230, 133) },
0827: { "khaki3", new SColor(205, 198, 115) },
0828: { "khaki4", new SColor(139, 134, 78) },
0829: { "lightgoldenrod1", new SColor(255, 236, 139) },
0830: { "lightgoldenrod2", new SColor(238, 220, 130) },
0831: { "lightgoldenrod3", new SColor(205, 190, 112) },
0832: { "lightgoldenrod4", new SColor(139, 129, 76) },
0833: { "lightyellow1", new SColor(255, 255, 224) },
0834: { "lightyellow2", new SColor(238, 238, 209) },
0835: { "lightyellow3", new SColor(205, 205, 180) },
0836: { "lightyellow4", new SColor(139, 139, 122) },
0837: { "yellow1", new SColor(255, 255, 0) },
0838: { "yellow2", new SColor(238, 238, 0) },
0839: { "yellow3", new SColor(205, 205, 0) },
0840: { "yellow4", new SColor(139, 139, 0) },
0841: { "gold1", new SColor(255, 215, 0) },
0842: { "gold2", new SColor(238, 201, 0) },
0843: { "gold3", new SColor(205, 173, 0) },
0844: { "gold4", new SColor(139, 117, 0) },
0845: { "goldenrod1", new SColor(255, 193, 37) },
0846: { "goldenrod2", new SColor(238, 180, 34) },
0847: { "goldenrod3", new SColor(205, 155, 29) },
0848: { "goldenrod4", new SColor(139, 105, 20) },
0849: { "darkgoldenrod1", new SColor(255, 185, 15) },
0850: { "darkgoldenrod2", new SColor(238, 173, 14) },
0851: { "darkgoldenrod3", new SColor(205, 149, 12) },
0852: { "darkgoldenrod4", new SColor(139, 101, 8) },
0853: { "rosybrown1", new SColor(255, 193, 193) },
0854: { "rosybrown2", new SColor(238, 180, 180) },
0855: { "rosybrown3", new SColor(205, 155, 155) },
0856: { "rosybrown4", new SColor(139, 105, 105) },
0857: { "indianred1", new SColor(255, 106, 106) },
0858: { "indianred2", new SColor(238, 99, 99) },
0859: { "indianred3", new SColor(205, 85, 85) },
0860: { "indianred4", new SColor(139, 58, 58) },
0861: { "sienna1", new SColor(255, 130, 71) },
0862: { "sienna2", new SColor(238, 121, 66) },
0863: { "sienna3", new SColor(205, 104, 57) },
0864: { "sienna4", new SColor(139, 71, 38) },
0865: { "burlywood1", new SColor(255, 211, 155) },
0866: { "burlywood2", new SColor(238, 197, 145) },
0867: { "burlywood3", new SColor(205, 170, 125) },
0868: { "burlywood4", new SColor(139, 115, 85) },
0869: { "wheat1", new SColor(255, 231, 186) },
0870: { "wheat2", new SColor(238, 216, 174) },
0871: { "wheat3", new SColor(205, 186, 150) },
0872: { "wheat4", new SColor(139, 126, 102) },
0873: { "tan1", new SColor(255, 165, 79) },
0874: { "tan2", new SColor(238, 154, 73) },
0875: { "tan3", new SColor(205, 133, 63) },
0876: { "tan4", new SColor(139, 90, 43) },
0877: { "chocolate1", new SColor(255, 127, 36) },
0878: { "chocolate2", new SColor(238, 118, 33) },
0879: { "chocolate3", new SColor(205, 102, 29) },
0880: { "chocolate4", new SColor(139, 69, 19) },
0881: { "firebrick1", new SColor(255, 48, 48) },
0882: { "firebrick2", new SColor(238, 44, 44) },
0883: { "firebrick3", new SColor(205, 38, 38) },
0884: { "firebrick4", new SColor(139, 26, 26) },
0885: { "brown1", new SColor(255, 64, 64) },
0886: { "brown2", new SColor(238, 59, 59) },
0887: { "brown3", new SColor(205, 51, 51) },
0888: { "brown4", new SColor(139, 35, 35) },
0889: { "salmon1", new SColor(255, 140, 105) },
0890: { "salmon2", new SColor(238, 130, 98) },
0891: { "salmon3", new SColor(205, 112, 84) },
0892: { "salmon4", new SColor(139, 76, 57) },
0893: { "lightsalmon1", new SColor(255, 160, 122) },
0894: { "lightsalmon2", new SColor(238, 149, 114) },
0895: { "lightsalmon3", new SColor(205, 129, 98) },
0896: { "lightsalmon4", new SColor(139, 87, 66) },
0897: { "orange1", new SColor(255, 165, 0) },
0898: { "orange2", new SColor(238, 154, 0) },
0899: { "orange3", new SColor(205, 133, 0) },
0900: { "orange4", new SColor(139, 90, 0) },
0901: { "darkorange1", new SColor(255, 127, 0) },
0902: { "darkorange2", new SColor(238, 118, 0) },
0903: { "darkorange3", new SColor(205, 102, 0) },
0904: { "darkorange4", new SColor(139, 69, 0) },
0905: { "coral1", new SColor(255, 114, 86) },
0906: { "coral2", new SColor(238, 106, 80) },
0907: { "coral3", new SColor(205, 91, 69) },
0908: { "coral4", new SColor(139, 62, 47) },
0909: { "tomato1", new SColor(255, 99, 71) },
0910: { "tomato2", new SColor(238, 92, 66) },
0911: { "tomato3", new SColor(205, 79, 57) },
0912: { "tomato4", new SColor(139, 54, 38) },
0913: { "orangered1", new SColor(255, 69, 0) },
0914: { "orangered2", new SColor(238, 64, 0) },
0915: { "orangered3", new SColor(205, 55, 0) },
0916: { "orangered4", new SColor(139, 37, 0) },
0917: { "red1", new SColor(255, 0, 0) },
0918: { "red2", new SColor(238, 0, 0) },
0919: { "red3", new SColor(205, 0, 0) },
0920: { "red4", new SColor(139, 0, 0) },
0921: { "deeppink1", new SColor(255, 20, 147) },
0922: { "deeppink2", new SColor(238, 18, 137) },
0923: { "deeppink3", new SColor(205, 16, 118) },
0924: { "deeppink4", new SColor(139, 10, 80) },
0925: { "hotpink1", new SColor(255, 110, 180) },
0926: { "hotpink2", new SColor(238, 106, 167) },
0927: { "hotpink3", new SColor(205, 96, 144) },
0928: { "hotpink4", new SColor(139, 58, 98) },
0929: { "pink1", new SColor(255, 181, 197) },
0930: { "pink2", new SColor(238, 169, 184) },
0931: { "pink3", new SColor(205, 145, 158) },
0932: { "pink4", new SColor(139, 99, 108) },
0933: { "lightpink1", new SColor(255, 174, 185) },
0934: { "lightpink2", new SColor(238, 162, 173) },
0935: { "lightpink3", new SColor(205, 140, 149) },
0936: { "lightpink4", new SColor(139, 95, 101) },
0937: { "palevioletred1", new SColor(255, 130, 171) },
0938: { "palevioletred2", new SColor(238, 121, 159) },
0939: { "palevioletred3", new SColor(205, 104, 137) },
0940: { "palevioletred4", new SColor(139, 71, 93) },
0941: { "maroon1", new SColor(255, 52, 179) },
0942: { "maroon2", new SColor(238, 48, 167) },
0943: { "maroon3", new SColor(205, 41, 144) },
0944: { "maroon4", new SColor(139, 28, 98) },
0945: { "violetred1", new SColor(255, 62, 150) },
0946: { "violetred2", new SColor(238, 58, 140) },
0947: { "violetred3", new SColor(205, 50, 120) },
0948: { "violetred4", new SColor(139, 34, 82) },
0949: { "magenta1", new SColor(255, 0, 255) },
0950: { "magenta2", new SColor(238, 0, 238) },
0951: { "magenta3", new SColor(205, 0, 205) },
0952: { "magenta4", new SColor(139, 0, 139) },
0953: { "orchid1", new SColor(255, 131, 250) },
0954: { "orchid2", new SColor(238, 122, 233) },
0955: { "orchid3", new SColor(205, 105, 201) },
0956: { "orchid4", new SColor(139, 71, 137) },
0957: { "plum1", new SColor(255, 187, 255) },
0958: { "plum2", new SColor(238, 174, 238) },
0959: { "plum3", new SColor(205, 150, 205) },
0960: { "plum4", new SColor(139, 102, 139) },
0961: { "mediumorchid1", new SColor(224, 102, 255) },
0962: { "mediumorchid2", new SColor(209, 95, 238) },
0963: { "mediumorchid3", new SColor(180, 82, 205) },
0964: { "mediumorchid4", new SColor(122, 55, 139) },
0965: { "darkorchid1", new SColor(191, 62, 255) },
0966: { "darkorchid2", new SColor(178, 58, 238) },
0967: { "darkorchid3", new SColor(154, 50, 205) },
0968: { "darkorchid4", new SColor(104, 34, 139) },
0969: { "purple1", new SColor(155, 48, 255) },
0970: { "purple2", new SColor(145, 44, 238) },
0971: { "purple3", new SColor(125, 38, 205) },
0972: { "purple4", new SColor(85, 26, 139) },
0973: { "mediumpurple1", new SColor(171, 130, 255) },
0974: { "mediumpurple2", new SColor(159, 121, 238) },
0975: { "mediumpurple3", new SColor(137, 104, 205) },
0976: { "mediumpurple4", new SColor(93, 71, 139) },
0977: { "thistle1", new SColor(255, 225, 255) },
0978: { "thistle2", new SColor(238, 210, 238) },
0979: { "thistle3", new SColor(205, 181, 205) },
0980: { "thistle4", new SColor(139, 123, 139) },
0981: { "gray0", new SColor(0, 0, 0) },
0982: { "grey0", new SColor(0, 0, 0) },
0983: { "gray1", new SColor(3, 3, 3) },
0984: { "grey1", new SColor(3, 3, 3) },
0985: { "gray2", new SColor(5, 5, 5) },
0986: { "grey2", new SColor(5, 5, 5) },
0987: { "gray3", new SColor(8, 8, 8) },
0988: { "grey3", new SColor(8, 8, 8) },
0989: { "gray4", new SColor(10, 10, 10) },
0990: { "grey4", new SColor(10, 10, 10) },
0991: { "gray5", new SColor(13, 13, 13) },
0992: { "grey5", new SColor(13, 13, 13) },
0993: { "gray6", new SColor(15, 15, 15) },
0994: { "grey6", new SColor(15, 15, 15) },
0995: { "gray7", new SColor(18, 18, 18) },
0996: { "grey7", new SColor(18, 18, 18) },
0997: { "gray8", new SColor(20, 20, 20) },
0998: { "grey8", new SColor(20, 20, 20) },
0999: { "gray9", new SColor(23, 23, 23) },
1000: { "grey9", new SColor(23, 23, 23) },
1001: { "gray10", new SColor(26, 26, 26) },
1002: { "grey10", new SColor(26, 26, 26) },
1003: { "gray11", new SColor(28, 28, 28) },
1004: { "grey11", new SColor(28, 28, 28) },
1005: { "gray12", new SColor(31, 31, 31) },
1006: { "grey12", new SColor(31, 31, 31) },
1007: { "gray13", new SColor(33, 33, 33) },
1008: { "grey13", new SColor(33, 33, 33) },
1009: { "gray14", new SColor(36, 36, 36) },
1010: { "grey14", new SColor(36, 36, 36) },
1011: { "gray15", new SColor(38, 38, 38) },
1012: { "grey15", new SColor(38, 38, 38) },
1013: { "gray16", new SColor(41, 41, 41) },
1014: { "grey16", new SColor(41, 41, 41) },
1015: { "gray17", new SColor(43, 43, 43) },
1016: { "grey17", new SColor(43, 43, 43) },
1017: { "gray18", new SColor(46, 46, 46) },
1018: { "grey18", new SColor(46, 46, 46) },
1019: { "gray19", new SColor(48, 48, 48) },
1020: { "grey19", new SColor(48, 48, 48) },
1021: { "gray20", new SColor(51, 51, 51) },
1022: { "grey20", new SColor(51, 51, 51) },
1023: { "gray21", new SColor(54, 54, 54) },
1024: { "grey21", new SColor(54, 54, 54) },
1025: { "gray22", new SColor(56, 56, 56) },
1026: { "grey22", new SColor(56, 56, 56) },
1027: { "gray23", new SColor(59, 59, 59) },
1028: { "grey23", new SColor(59, 59, 59) },
1029: { "gray24", new SColor(61, 61, 61) },
1030: { "grey24", new SColor(61, 61, 61) },
1031: { "gray25", new SColor(64, 64, 64) },
1032: { "grey25", new SColor(64, 64, 64) },
1033: { "gray26", new SColor(66, 66, 66) },
1034: { "grey26", new SColor(66, 66, 66) },
1035: { "gray27", new SColor(69, 69, 69) },
1036: { "grey27", new SColor(69, 69, 69) },
1037: { "gray28", new SColor(71, 71, 71) },
1038: { "grey28", new SColor(71, 71, 71) },
1039: { "gray29", new SColor(74, 74, 74) },
1040: { "grey29", new SColor(74, 74, 74) },
1041: { "gray30", new SColor(77, 77, 77) },
1042: { "grey30", new SColor(77, 77, 77) },
1043: { "gray31", new SColor(79, 79, 79) },
1044: { "grey31", new SColor(79, 79, 79) },
1045: { "gray32", new SColor(82, 82, 82) },
1046: { "grey32", new SColor(82, 82, 82) },
1047: { "gray33", new SColor(84, 84, 84) },
1048: { "grey33", new SColor(84, 84, 84) },
1049: { "gray34", new SColor(87, 87, 87) },
1050: { "grey34", new SColor(87, 87, 87) },
1051: { "gray35", new SColor(89, 89, 89) },
1052: { "grey35", new SColor(89, 89, 89) },
1053: { "gray36", new SColor(92, 92, 92) },
1054: { "grey36", new SColor(92, 92, 92) },
1055: { "gray37", new SColor(94, 94, 94) },
1056: { "grey37", new SColor(94, 94, 94) },
1057: { "gray38", new SColor(97, 97, 97) },
1058: { "grey38", new SColor(97, 97, 97) },
1059: { "gray39", new SColor(99, 99, 99) },
1060: { "grey39", new SColor(99, 99, 99) },
1061: { "gray40", new SColor(102, 102, 102) },
1062: { "grey40", new SColor(102, 102, 102) },
1063: { "gray41", new SColor(105, 105, 105) },
1064: { "grey41", new SColor(105, 105, 105) },
1065: { "gray42", new SColor(107, 107, 107) },
1066: { "grey42", new SColor(107, 107, 107) },
1067: { "gray43", new SColor(110, 110, 110) },
1068: { "grey43", new SColor(110, 110, 110) },
1069: { "gray44", new SColor(112, 112, 112) },
1070: { "grey44", new SColor(112, 112, 112) },
1071: { "gray45", new SColor(115, 115, 115) },
1072: { "grey45", new SColor(115, 115, 115) },
1073: { "gray46", new SColor(117, 117, 117) },
1074: { "grey46", new SColor(117, 117, 117) },
1075: { "gray47", new SColor(120, 120, 120) },
1076: { "grey47", new SColor(120, 120, 120) },
1077: { "gray48", new SColor(122, 122, 122) },
1078: { "grey48", new SColor(122, 122, 122) },
1079: { "gray49", new SColor(125, 125, 125) },
1080: { "grey49", new SColor(125, 125, 125) },
1081: { "gray50", new SColor(127, 127, 127) },
1082: { "grey50", new SColor(127, 127, 127) },
1083: { "gray51", new SColor(130, 130, 130) },
1084: { "grey51", new SColor(130, 130, 130) },
1085: { "gray52", new SColor(133, 133, 133) },
1086: { "grey52", new SColor(133, 133, 133) },
1087: { "gray53", new SColor(135, 135, 135) },
1088: { "grey53", new SColor(135, 135, 135) },
1089: { "gray54", new SColor(138, 138, 138) },
1090: { "grey54", new SColor(138, 138, 138) },
1091: { "gray55", new SColor(140, 140, 140) },
1092: { "grey55", new SColor(140, 140, 140) },
1093: { "gray56", new SColor(143, 143, 143) },
1094: { "grey56", new SColor(143, 143, 143) },
1095: { "gray57", new SColor(145, 145, 145) },
1096: { "grey57", new SColor(145, 145, 145) },
1097: { "gray58", new SColor(148, 148, 148) },
1098: { "grey58", new SColor(148, 148, 148) },
1099: { "gray59", new SColor(150, 150, 150) },
1100: { "grey59", new SColor(150, 150, 150) },
1101: { "gray60", new SColor(153, 153, 153) },
1102: { "grey60", new SColor(153, 153, 153) },
1103: { "gray61", new SColor(156, 156, 156) },
1104: { "grey61", new SColor(156, 156, 156) },
1105: { "gray62", new SColor(158, 158, 158) },
1106: { "grey62", new SColor(158, 158, 158) },
1107: { "gray63", new SColor(161, 161, 161) },
1108: { "grey63", new SColor(161, 161, 161) },
1109: { "gray64", new SColor(163, 163, 163) },
1110: { "grey64", new SColor(163, 163, 163) },
1111: { "gray65", new SColor(166, 166, 166) },
1112: { "grey65", new SColor(166, 166, 166) },
1113: { "gray66", new SColor(168, 168, 168) },
1114: { "grey66", new SColor(168, 168, 168) },
1115: { "gray67", new SColor(171, 171, 171) },
1116: { "grey67", new SColor(171, 171, 171) },
1117: { "gray68", new SColor(173, 173, 173) },
1118: { "grey68", new SColor(173, 173, 173) },
1119: { "gray69", new SColor(176, 176, 176) },
1120: { "grey69", new SColor(176, 176, 176) },
1121: { "gray70", new SColor(179, 179, 179) },
1122: { "grey70", new SColor(179, 179, 179) },
1123: { "gray71", new SColor(181, 181, 181) },
1124: { "grey71", new SColor(181, 181, 181) },
1125: { "gray72", new SColor(184, 184, 184) },
1126: { "grey72", new SColor(184, 184, 184) },
1127: { "gray73", new SColor(186, 186, 186) },
1128: { "grey73", new SColor(186, 186, 186) },
1129: { "gray74", new SColor(189, 189, 189) },
1130: { "grey74", new SColor(189, 189, 189) },
1131: { "gray75", new SColor(191, 191, 191) },
1132: { "grey75", new SColor(191, 191, 191) },
1133: { "gray76", new SColor(194, 194, 194) },
1134: { "grey76", new SColor(194, 194, 194) },
1135: { "gray77", new SColor(196, 196, 196) },
1136: { "grey77", new SColor(196, 196, 196) },
1137: { "gray78", new SColor(199, 199, 199) },
1138: { "grey78", new SColor(199, 199, 199) },
1139: { "gray79", new SColor(201, 201, 201) },
1140: { "grey79", new SColor(201, 201, 201) },
1141: { "gray80", new SColor(204, 204, 204) },
1142: { "grey80", new SColor(204, 204, 204) },
1143: { "gray81", new SColor(207, 207, 207) },
1144: { "grey81", new SColor(207, 207, 207) },
1145: { "gray82", new SColor(209, 209, 209) },
1146: { "grey82", new SColor(209, 209, 209) },
1147: { "gray83", new SColor(212, 212, 212) },
1148: { "grey83", new SColor(212, 212, 212) },
1149: { "gray84", new SColor(214, 214, 214) },
1150: { "grey84", new SColor(214, 214, 214) },
1151: { "gray85", new SColor(217, 217, 217) },
1152: { "grey85", new SColor(217, 217, 217) },
1153: { "gray86", new SColor(219, 219, 219) },
1154: { "grey86", new SColor(219, 219, 219) },
1155: { "gray87", new SColor(222, 222, 222) },
1156: { "grey87", new SColor(222, 222, 222) },
1157: { "gray88", new SColor(224, 224, 224) },
1158: { "grey88", new SColor(224, 224, 224) },
1159: { "gray89", new SColor(227, 227, 227) },
1160: { "grey89", new SColor(227, 227, 227) },
1161: { "gray90", new SColor(229, 229, 229) },
1162: { "grey90", new SColor(229, 229, 229) },
1163: { "gray91", new SColor(232, 232, 232) },
1164: { "grey91", new SColor(232, 232, 232) },
1165: { "gray92", new SColor(235, 235, 235) },
1166: { "grey92", new SColor(235, 235, 235) },
1167: { "gray93", new SColor(237, 237, 237) },
1168: { "grey93", new SColor(237, 237, 237) },
1169: { "gray94", new SColor(240, 240, 240) },
1170: { "grey94", new SColor(240, 240, 240) },
1171: { "gray95", new SColor(242, 242, 242) },
1172: { "grey95", new SColor(242, 242, 242) },
1173: { "gray96", new SColor(245, 245, 245) },
1174: { "grey96", new SColor(245, 245, 245) },
1175: { "gray97", new SColor(247, 247, 247) },
1176: { "grey97", new SColor(247, 247, 247) },
1177: { "gray98", new SColor(250, 250, 250) },
1178: { "grey98", new SColor(250, 250, 250) },
1179: { "gray99", new SColor(252, 252, 252) },
1180: { "grey99", new SColor(252, 252, 252) },
1181: { "gray100", new SColor(255, 255, 255) },
1182: { "grey100", new SColor(255, 255, 255) },
1183: { "dark grey", new SColor(169, 169, 169) },
1184: { "darkgrey", new SColor(169, 169, 169) },
1185: { "dark gray", new SColor(169, 169, 169) },
1186: { "darkgray", new SColor(169, 169, 169) },
1187: { "dark blue", new SColor(0, 0, 139) },
1188: { "darkblue", new SColor(0, 0, 139) },
1189: { "dark cyan", new SColor(0, 139, 139) },
1190: { "darkcyan", new SColor(0, 139, 139) },
1191: { "dark magenta", new SColor(139, 0, 139) },
1192: { "darkmagenta", new SColor(139, 0, 139) },
1193: { "dark red", new SColor(139, 0, 0) },
1194: { "darkred", new SColor(139, 0, 0) },
1195: { "light", new SColor(144, 238, 144) } };
1196:
1197: //Cache the colors
1198: static HashMap colors = new HashMap(colorArray.length);
1199:
1200: //Cache the inverse colors
1201: static HashMap inverseColors = new HashMap();
1202:
1203: //Cache the strings underlying the colors.
1204: static HashMap hexStrings = new HashMap();
1205: static HashMap inverseHexStrings = new HashMap();
1206: static HashMap brighterHexStrings = new HashMap();
1207: static HashMap darkerHexStrings = new HashMap();
1208:
1209: protected int value;
1210:
1211: static {
1212: for (int count = 0; count < colorArray.length; count++) {
1213: colors.put(colorArray[count][0], colorArray[count][1]);
1214: }
1215: }
1216:
1217: //AWT SColors
1218: public final static SColor white = getColor("white");
1219: public final static SColor lightGray = getColor("lightgrey");
1220: public final static SColor gray = getColor("grey");
1221: public final static SColor darkGray = getColor("darkgrey");
1222: public final static SColor black = getColor("black");
1223: public final static SColor red = getColor("red");
1224: public final static SColor pink = getColor("pink");
1225: public final static SColor orange = getColor("orange");
1226: public final static SColor yellow = getColor("yellow");
1227: public final static SColor green = getColor("green");
1228: public final static SColor magenta = getColor("magenta");
1229: public final static SColor cyan = getColor("cyan");
1230: public final static SColor blue = getColor("blue");
1231:
1232: public static void main(String[] args) {
1233: System.out.println(SColor.match(new SColor(153, 153, 204)));
1234:
1235: while (true) {
1236: }
1237: }
1238:
1239: }
|