de.folt.util
Class ColorTable

java.lang.Object
  extended by de.folt.util.ColorTable

public class ColorTable
extends java.lang.Object

Class implements RGB color names and maps them to their resp. RGB value. RGB names and colors taken from http://www.w3.org/TR/css3-color/#x11-color
The following color names are supported (if color name not found RGB for red is returned).

"aliceblue", new RGB(240,248,255)
"antiquewhite", new RGB(250,235,215)
"aqua", new RGB(0,255,255)
"aquamarine", new RGB(127,255,212)
"azure", new RGB(240,255,255)
"beige", new RGB(245,245,220)
"bisque", new RGB(255,228,196)
"black", new RGB(0,0,0)
"blanchedalmond", new RGB(255,235,205)
"blue", new RGB(0,0,255)
"blueviolet", new RGB(138,43,226)
"brown", new RGB(165,42,42)
"burlywood", new RGB(222,184,135)
"cadetblue", new RGB(95,158,160)
"chartreuse", new RGB(127,255,0)
"chocolate", new RGB(210,105,30)
"coral", new RGB(255,127,80)
"cornflowerblue", new RGB(100,149,237)
"cornsilk", new RGB(255,248,220)
"crimson", new RGB(220,20,60)
"cyan", new RGB(0,255,255)
"darkblue", new RGB(0,0,139)
"darkcyan", new RGB(0,139,139)
"darkgoldenrod", new RGB(184,134,11)
"darkgray", new RGB(169,169,169)
"darkgreen", new RGB(0,100,0)
"darkgrey", new RGB(169,169,169)
"darkkhaki", new RGB(189,183,107)
"darkmagenta", new RGB(139,0,139)
"darkolivegreen", new RGB(85,107,47)
"darkorange", new RGB(255,140,0)
"darkorchid", new RGB(153,50,204)
"darkred", new RGB(139,0,0)
"darksalmon", new RGB(233,150,122)
"darkseagreen", new RGB(143,188,143)
"darkslateblue", new RGB(72,61,139)
"darkslategray", new RGB(47,79,79)
"darkslategrey", new RGB(47,79,79)
"darkturquoise", new RGB(0,206,209)
"darkviolet", new RGB(148,0,211)
"deeppink", new RGB(255,20,147)
"deepskyblue", new RGB(0,191,255)
"dimgray", new RGB(105,105,105)
"dimgrey", new RGB(105,105,105)
"dodgerblue", new RGB(30,144,255)
"firebrick", new RGB(178,34,34)
"floralwhite", new RGB(255,250,240)
"forestgreen", new RGB(34,139,34)
"fuchsia", new RGB(255,0,255)
"gainsboro", new RGB(220,220,220)
"ghostwhite", new RGB(248,248,255)
"gold", new RGB(255,215,0)
"goldenrod", new RGB(218,165,32)
"gray", new RGB(128,128,128)
"green", new RGB(0,128,0)
"greenyellow", new RGB(173,255,47)
"grey", new RGB(128,128,128)
"honeydew", new RGB(240,255,240)
"hotpink", new RGB(255,105,180)
"indianred", new RGB(205,92,92)
"indigo", new RGB(75,0,130)
"ivory", new RGB(255,255,240)
"khaki", new RGB(240,230,140)
"lavender", new RGB(230,230,250)
"lavenderblush", new RGB(255,240,245)
"lawngreen", new RGB(124,252,0)
"lemonchiffon", new RGB(255,250,205)
"lightblue", new RGB(173,216,230)
"lightcoral", new RGB(240,128,128)
"lightcyan", new RGB(224,255,255)
"lightgoldenrodyellow", new RGB(250,250,210)
"lightgray", new RGB(211,211,211)
"lightgreen", new RGB(144,238,144)
"lightgrey", new RGB(211,211,211)
"lightpink", new RGB(255,182,193)
"lightsalmon", new RGB(255,160,122)
"lightseagreen", new RGB(32,178,170)
"lightskyblue", new RGB(135,206,250)
"lightslategray", new RGB(119,136,153)
"lightslategrey", new RGB(119,136,153)
"lightsteelblue", new RGB(176,196,222)
"lightyellow", new RGB(255,255,224)
"lime", new RGB(0,255,0)
"limegreen", new RGB(50,205,50)
"linen", new RGB(250,240,230)
"magenta", new RGB(255,0,255)
"maroon", new RGB(128,0,0)
"mediumaquamarine", new RGB(102,205,170)
"mediumblue", new RGB(0,0,205)
"mediumorchid", new RGB(186,85,211)
"mediumpurple", new RGB(147,112,219)
"mediumseagreen", new RGB(60,179,113)
"mediumslateblue", new RGB(123,104,238)
"mediumspringgreen", new RGB(0,250,154)
"mediumturquoise", new RGB(72,209,204)
"mediumvioletred", new RGB(199,21,133)
"midnightblue", new RGB(25,25,112)
"mintcream", new RGB(245,255,250)
"mistyrose", new RGB(255,228,225)
"moccasin", new RGB(255,228,181)
"navajowhite", new RGB(255,222,173)
"navy", new RGB(0,0,128)
"oldlace", new RGB(253,245,230)
"olive", new RGB(128,128,0)
"olivedrab", new RGB(107,142,35)
"orange", new RGB(255,165,0)
"orangered", new RGB(255,69,0)
"orchid", new RGB(218,112,214)
"palegoldenrod", new RGB(238,232,170)
"palegreen", new RGB(152,251,152)
"paleturquoise", new RGB(175,238,238)
"palevioletred", new RGB(219,112,147)
"papayawhip", new RGB(255,239,213)
"peachpuff", new RGB(255,218,185)
"peru", new RGB(205,133,63)
"pink", new RGB(255,192,203)
"plum", new RGB(221,160,221)
"powderblue", new RGB(176,224,230)
"purple", new RGB(128,0,128)
"red", new RGB(255,0,0)
"rosybrown", new RGB(188,143,143)
"royalblue", new RGB(65,105,225)
"saddlebrown", new RGB(139,69,19)
"salmon", new RGB(250,128,114)
"sandybrown", new RGB(244,164,96)
"seagreen", new RGB(46,139,87)
"seashell", new RGB(255,245,238)
"sienna", new RGB(160,82,45)
"silver", new RGB(192,192,192)
"skyblue", new RGB(135,206,235)
"slateblue", new RGB(106,90,205)
"slategray", new RGB(112,128,144)
"slategrey", new RGB(112,128,144)
"snow", new RGB(255,250,250)
"springgreen", new RGB(0,255,127)
"steelblue", new RGB(70,130,180)
"tan", new RGB(210,180,140)
"teal", new RGB(0,128,128)
"thistle", new RGB(216,191,216)
"tomato", new RGB(255,99,71)
"turquoise", new RGB(64,224,208)
"violet", new RGB(238,130,238)
"wheat", new RGB(245,222,179)
"white", new RGB(255,255,255)
"whitesmoke", new RGB(245,245,245)
"yellow", new RGB(255,255,0)
"yellowgreen", new RGB(154,205,50)
 

Author:
klemens

Field Summary
static java.util.Hashtable<java.lang.String,org.eclipse.swt.graphics.RGB> colorNameRGB
           
static java.lang.String[] colorNames
           
 
Constructor Summary
ColorTable()
           
 
Method Summary
static java.util.Hashtable<java.lang.String,org.eclipse.swt.graphics.RGB> getColorNameRGB()
           
static java.lang.String[] getColorNames()
          Method returns a string array of supported color name
static org.eclipse.swt.graphics.Color getInstance(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.RGB colorRGB)
          getInstance get an instance of color based on RGB Value
static org.eclipse.swt.graphics.Color getInstance(org.eclipse.swt.graphics.Device device, java.lang.String colorName)
          getInstance get an instance of color based on a name
static org.eclipse.swt.graphics.RGB getRGBByName(java.lang.String colorName)
          getRGBByName returns the RGB value for a given color name; the color name is converted to lower case
static boolean isInstantiatedColor(java.lang.String colorName)
          isInstantiatedColor check if a color has been instatiated
static void removeInstance()
          removeInstance remove and dispose all the allocated colors
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colorNameRGB

public static java.util.Hashtable<java.lang.String,org.eclipse.swt.graphics.RGB> colorNameRGB

colorNames

public static java.lang.String[] colorNames
Constructor Detail

ColorTable

public ColorTable()
Method Detail

getColorNameRGB

public static java.util.Hashtable<java.lang.String,org.eclipse.swt.graphics.RGB> getColorNameRGB()
Returns:
the colorNameRGB (hash table with key color name and value is RGB

getColorNames

public static java.lang.String[] getColorNames()
Method returns a string array of supported color name

Returns:
the colorNames

getInstance

public static org.eclipse.swt.graphics.Color getInstance(org.eclipse.swt.graphics.Device device,
                                                         org.eclipse.swt.graphics.RGB colorRGB)
getInstance get an instance of color based on RGB Value

Parameters:
device - the device for the color display
color - RGB value
Returns:
the matching Color

getInstance

public static org.eclipse.swt.graphics.Color getInstance(org.eclipse.swt.graphics.Device device,
                                                         java.lang.String colorName)
getInstance get an instance of color based on a name

Parameters:
device - the device for the color display
colorName - a string with the color names
Returns:
the matching Color

getRGBByName

public static org.eclipse.swt.graphics.RGB getRGBByName(java.lang.String colorName)
getRGBByName returns the RGB value for a given color name; the color name is converted to lower case

Parameters:
colorName - the color name e.g. green
Returns:
the RGB value for the color; red is returned if the color does not exist

isInstantiatedColor

public static boolean isInstantiatedColor(java.lang.String colorName)
isInstantiatedColor check if a color has been instatiated

Parameters:
colorName - the color name
Returns:
true if instatiated otherwise false;

removeInstance

public static void removeInstance()
removeInstance remove and dispose all the allocated colors