1 22 23 package caramel.util; 24 25 import java.awt.*; 26 import java.util.*; 27 28 32 33 public class ColorUtils 34 { 35 36 public final static Color aliceblue = new Color( 240, 248, 255 ); 37 public final static Color antiquewhite = new Color( 250, 235, 215 ); 38 public final static Color aqua = new Color( 0, 255, 255 ); 39 public final static Color aquamarine = new Color( 127, 255, 212 ); 40 public final static Color azure = new Color( 240, 255, 255 ); 41 public final static Color beige = new Color( 245, 245, 220 ); 42 public final static Color bisque = new Color( 255, 228, 196 ); 43 public final static Color black = new Color( 0, 0, 0 ); 44 public final static Color blanchedalmond = new Color( 255, 255, 205 ); 45 public final static Color blue = new Color( 0, 0, 255 ); 46 public final static Color blueviolet = new Color( 138, 43, 226 ); 47 public final static Color brown = new Color( 165, 42, 42 ); 48 public final static Color burlywood = new Color( 222, 184, 135 ); 49 public final static Color cadetblue = new Color( 95, 158, 160 ); 50 public final static Color chartreuse = new Color( 127, 255, 0 ); 51 public final static Color chocolate = new Color( 210, 105, 30 ); 52 public final static Color coral = new Color( 255, 127, 80 ); 53 public final static Color cornflowerblue = new Color( 100, 149, 237 ); 54 public final static Color cornsilk = new Color( 255, 248, 220 ); 55 public final static Color crimson = new Color( 220, 20, 60 ); 56 public final static Color cyan = new Color( 0, 255, 255 ); 57 public final static Color darkblue = new Color( 0, 0, 139 ); 58 public final static Color darkcyan = new Color( 0, 139, 139 ); 59 public final static Color darkgoldenrod = new Color( 184, 134, 11 ); 60 public final static Color darkgray = new Color( 169, 169, 169 ); 61 public final static Color darkgreen = new Color( 0, 100, 0 ); 62 public final static Color darkkhaki = new Color( 189, 183, 107 ); 63 public final static Color darkmagenta = new Color( 139, 0, 139 ); 64 public final static Color darkolivegreen = new Color( 85, 107, 47 ); 65 public final static Color darkorange = new Color( 255, 140, 0 ); 66 public final static Color darkorchid = new Color( 153, 50, 204 ); 67 public final static Color darkred = new Color( 139, 0, 0 ); 68 public final static Color darksalmon = new Color( 233, 150, 122 ); 69 public final static Color darkseagreen = new Color( 143, 188, 143 ); 70 public final static Color darkslateblue = new Color( 72, 61, 139 ); 71 public final static Color darkslategray = new Color( 47, 79, 79 ); 72 public final static Color darkturquoise = new Color( 0, 206, 209 ); 73 public final static Color darkviolet = new Color( 148, 0, 211 ); 74 public final static Color deeppink = new Color( 255, 20, 147 ); 75 public final static Color deepskyblue = new Color( 0, 191, 255 ); 76 public final static Color dimgray = new Color( 105, 105, 105 ); 77 public final static Color dodgerblue = new Color( 30, 144, 255 ); 78 public final static Color firebrick = new Color( 178, 34, 34 ); 79 public final static Color floralwhite = new Color( 255, 250, 240 ); 80 public final static Color forestgreen = new Color( 34, 139, 34 ); 81 public final static Color fuchsia = new Color( 255, 0, 255 ); 82 public final static Color gainsboro = new Color( 220, 220, 220 ); 83 public final static Color ghostwhite = new Color( 248, 248, 255 ); 84 public final static Color gold = new Color( 255, 215, 0 ); 85 public final static Color goldenrod = new Color( 218, 165, 32 ); 86 public final static Color gray = new Color( 128, 128, 128 ); 87 public final static Color green = new Color( 0, 128, 0 ); 88 public final static Color greenyellow = new Color( 173, 255, 47 ); 89 public final static Color honeydew = new Color( 240, 255, 240 ); 90 public final static Color hotpink = new Color( 255, 105, 180 ); 91 public final static Color indianred = new Color( 205, 92, 92 ); 92 public final static Color indigo = new Color( 75, 0, 130 ); 93 public final static Color ivory = new Color( 255, 240, 240 ); 94 public final static Color khaki = new Color( 240, 230, 140 ); 95 public final static Color lavender = new Color( 230, 230, 250 ); 96 public final static Color lavenderblush = new Color( 255, 240, 245 ); 97 public final static Color lawngreen = new Color( 124, 252, 0 ); 98 public final static Color lemonchiffon = new Color( 255, 250, 205 ); 99 public final static Color lightblue = new Color( 173, 216, 230 ); 100 public final static Color lightcoral = new Color( 240, 128, 128 ); 101 public final static Color lightcyan = new Color( 224, 255, 255 ); 102 public final static Color lightgoldenrodyellow = new Color( 250, 250, 210 ); 103 public final static Color lightgreen = new Color( 144, 238, 144 ); 104 public final static Color lightgrey = new Color( 211, 211, 211 ); 105 public final static Color lightpink = new Color( 255, 182, 193 ); 106 public final static Color lightsalmon = new Color( 255, 160, 122 ); 107 public final static Color lightseagreen = new Color( 32, 178, 170 ); 108 public final static Color lightskyblue = new Color( 135, 206, 250 ); 109 public final static Color lightslategray = new Color( 119, 136, 153 ); 110 public final static Color lightsteelblue = new Color( 176, 196, 222 ); 111 public final static Color lightyellow = new Color( 255, 255, 224 ); 112 public final static Color lime = new Color( 0, 255, 0 ); 113 public final static Color limegreen = new Color( 50, 205, 50 ); 114 public final static Color linen = new Color( 250, 240, 230 ); 115 public final static Color magenta = new Color( 255, 0, 255 ); 116 public final static Color maroon = new Color( 128, 0, 0 ); 117 public final static Color mediumaquamarine = new Color( 102, 205, 170 ); 118 public final static Color mediumblue = new Color( 0, 0, 205 ); 119 public final static Color mediumorchid = new Color( 186, 85, 211 ); 120 public final static Color mediumpurple = new Color( 147, 112, 219 ); 121 public final static Color mediumseagreen = new Color( 60, 179, 113 ); 122 public final static Color mediumslateblue = new Color( 123, 104, 238 ); 123 public final static Color mediumspringgreen = new Color( 0, 250, 154 ); 124 public final static Color mediumturquoise = new Color( 72, 209, 204 ); 125 public final static Color mediumvioletred = new Color( 199, 21, 133 ); 126 public final static Color midnightblue = new Color( 25, 25, 112 ); 127 public final static Color mintcream = new Color( 245, 255, 250 ); 128 public final static Color mistyrose = new Color( 255, 228, 225 ); 129 public final static Color mocassin = new Color( 255, 228, 181 ); 130 public final static Color navajowhite = new Color( 255, 222, 173 ); 131 public final static Color navy = new Color( 0, 0, 128 ); 132 public final static Color oldlace = new Color( 253, 245, 230 ); 133 public final static Color olive = new Color( 128, 128, 0 ); 134 public final static Color olivedrab = new Color( 107, 142, 35 ); 135 public final static Color orange = new Color( 255, 165, 0 ); 136 public final static Color orangered = new Color( 255, 69, 0 ); 137 public final static Color orchid = new Color( 218, 112, 214 ); 138 public final static Color palegoldenrod = new Color( 238, 232, 170 ); 139 public final static Color palegreen = new Color( 152, 251, 152 ); 140 public final static Color paleturquoise = new Color( 175, 238, 238 ); 141 public final static Color palevioletred = new Color( 219, 112, 147 ); 142 public final static Color papayawhip = new Color( 255, 239, 213 ); 143 public final static Color peachpuff = new Color( 255, 218, 185 ); 144 public final static Color peru = new Color( 205, 133, 63 ); 145 public final static Color pink = new Color( 255, 192, 203 ); 146 public final static Color plum = new Color( 221, 160, 221 ); 147 public final static Color powderblue = new Color( 176, 224, 230 ); 148 public final static Color purple = new Color( 128, 0, 128 ); 149 public final static Color red = new Color( 255, 0, 0 ); 150 public final static Color rosybrown = new Color( 188, 143, 143 ); 151 public final static Color royalblue = new Color( 65, 105, 225 ); 152 public final static Color saddlebrown = new Color( 139, 69, 19 ); 153 public final static Color salmon = new Color( 250, 128, 114 ); 154 public final static Color sandybrown = new Color( 244, 164, 96 ); 155 public final static Color seagreen = new Color( 46, 139, 87 ); 156 public final static Color seashell = new Color( 255, 245, 238 ); 157 public final static Color sienna = new Color( 160, 82, 45 ); 158 public final static Color silver = new Color( 192, 192, 192 ); 159 public final static Color skyblue = new Color( 135, 206, 235 ); 160 public final static Color slateblue = new Color( 106, 90, 205 ); 161 public final static Color slategray = new Color( 112, 128, 144 ); 162 public final static Color snow = new Color( 255, 250, 250 ); 163 public final static Color springgreen = new Color( 0, 255, 127 ); 164 public final static Color steelblue = new Color( 70, 138, 180 ); 165 public final static Color tan = new Color( 210, 180, 140 ); 166 public final static Color teal = new Color( 0, 128, 128 ); 167 public final static Color thistle = new Color( 216, 191, 216 ); 168 public final static Color tomato = new Color( 253, 99, 71 ); 169 public final static Color turquoise = new Color( 64, 224, 208 ); 170 public final static Color violet = new Color( 238, 130, 238 ); 171 public final static Color wheat = new Color( 245, 222, 179 ); 172 public final static Color white = new Color( 255, 255, 255 ); 173 public final static Color whitesmoke = new Color( 245, 245, 245 ); 174 public final static Color yellow = new Color( 255, 255, 0 ); 175 public final static Color yellowgreen = new Color( 154, 205, 50 ); 176 177 private static HashMap _colors; 178 179 private static Object [][] data = 180 { 181 {"aliceblue", aliceblue}, 182 {"antiquewhite", antiquewhite}, 183 {"aqua", aqua}, 184 {"aquamarine", aquamarine}, 185 {"azure", azure}, 186 {"beige", beige}, 187 {"bisque", bisque}, 188 {"black", black}, 189 {"blanchedalmond", blanchedalmond}, 190 {"blue", blue}, 191 {"blueviolet", blueviolet}, 192 {"brown", brown}, 193 {"burlywood", burlywood}, 194 {"cadetblue", cadetblue}, 195 {"chartreuse", chartreuse}, 196 {"chocolate", chocolate}, 197 {"coral", coral}, 198 {"cornflowerblue", cornflowerblue}, 199 {"cornsilk", cornsilk}, 200 {"crimson", crimson}, 201 {"cyan", cyan}, 202 {"darkblue", darkblue}, 203 {"darkcyan", darkcyan}, 204 {"darkgoldenrod", darkgoldenrod}, 205 {"darkgray", darkgray}, 206 {"darkgreen", darkgreen}, 207 {"darkkhaki", darkkhaki}, 208 {"darkmagenta", darkmagenta}, 209 {"darkolivegreen", darkolivegreen}, 210 {"darkorange", darkorange}, 211 {"darkorchid", darkorchid}, 212 {"darkred", darkred}, 213 {"darksalmon", darksalmon}, 214 {"darkseagreen", darkseagreen}, 215 {"darkslateblue", darkslateblue}, 216 {"darkslategray", darkslategray}, 217 {"darkturquoise", darkturquoise}, 218 {"darkviolet", darkviolet}, 219 {"deeppink", deeppink}, 220 {"deepskyblue", deepskyblue}, 221 {"dimgray", dimgray}, 222 {"dodgerblue", dodgerblue}, 223 {"firebrick", firebrick}, 224 {"floralwhite", floralwhite}, 225 {"forestgreen", forestgreen}, 226 {"fuchsia", fuchsia}, 227 {"gainsboro", gainsboro}, 228 {"ghostwhite", ghostwhite}, 229 {"gold", gold}, 230 {"goldenrod", goldenrod}, 231 {"gray", gray}, 232 {"green", green}, 233 {"greenyellow", greenyellow}, 234 {"honeydew", honeydew}, 235 {"hotpink", hotpink}, 236 {"indianred", indianred}, 237 {"indigo", indigo}, 238 {"ivory", ivory}, 239 {"khaki", khaki}, 240 {"lavender", lavender}, 241 {"lavenderblush", lavenderblush}, 242 {"lawngreen", lawngreen}, 243 {"lemonchiffon", lemonchiffon}, 244 {"lightblue", lightblue}, 245 {"lightcoral", lightcoral}, 246 {"lightcyan", lightcyan}, 247 {"lightgoldenrodyellow", lightgoldenrodyellow}, 248 {"lightgreen", lightgreen}, 249 {"lightgrey", lightgrey}, 250 {"lightpink", lightpink}, 251 {"lightsalmon", lightsalmon}, 252 {"lightseagreen", lightseagreen}, 253 {"lightskyblue", lightskyblue}, 254 {"lightslategray", lightslategray}, 255 {"lightsteelblue", lightsteelblue}, 256 {"lightyellow", lightyellow}, 257 {"lime", lime}, 258 {"limegreen", limegreen}, 259 {"linen", linen}, 260 {"magenta", magenta}, 261 {"maroon", maroon}, 262 {"mediumaquamarine", mediumaquamarine}, 263 {"mediumblue", mediumblue}, 264 {"mediumorchid", mediumorchid}, 265 {"mediumpurple", mediumpurple}, 266 {"mediumseagreen", mediumseagreen}, 267 {"mediumslateblue", mediumslateblue}, 268 {"mediumspringgreen", mediumspringgreen}, 269 {"mediumturquoise", mediumturquoise}, 270 {"mediumvioletred", mediumvioletred}, 271 {"midnightblue", midnightblue}, 272 {"mintcream", mintcream}, 273 {"mistyrose", mistyrose}, 274 {"moccasin", mocassin}, 275 {"navajowhite", navajowhite}, 276 {"navy", navy}, 277 {"oldlace", oldlace}, 278 {"olive", olive}, 279 {"olivedrab", olivedrab}, 280 {"orange", orange}, 281 {"orangered", orangered}, 282 {"orchid", orchid}, 283 {"palegoldenrod", palegoldenrod}, 284 {"palegreen", palegreen}, 285 {"paleturquoise", paleturquoise}, 286 {"palevioletred", palevioletred}, 287 {"papayawhip", papayawhip}, 288 {"peachpuff", peachpuff}, 289 {"peru", peru}, 290 {"pink", pink}, 291 {"plum", plum}, 292 {"powderblue", powderblue}, 293 {"purple", purple}, 294 {"red", red}, 295 {"rosybrown", rosybrown}, 296 {"royalblue", royalblue}, 297 {"saddlebrown", saddlebrown}, 298 {"salmon", salmon}, 299 {"sandybrown", sandybrown}, 300 {"seagreen", seagreen}, 301 {"seashell", seashell}, 302 {"sienna", sienna}, 303 {"silver", silver}, 304 {"skyblue", skyblue}, 305 {"slateblue", slateblue}, 306 {"slategray", slategray}, 307 {"snow", snow}, 308 {"springgreen", springgreen}, 309 {"steelblue", steelblue}, 310 {"tan", tan}, 311 {"teal", teal}, 312 {"thistle", thistle}, 313 {"tomato", tomato}, 314 {"turquoise", turquoise}, 315 {"violet", violet}, 316 {"wheat", wheat}, 317 {"white", white}, 318 {"whitesmoke", whitesmoke}, 319 {"yellow", yellow}, 320 {"yellowgreen", yellowgreen}, 321 }; 322 323 public static HashMap getColors() 324 { 325 return _colors; 326 } 327 328 public static Color findColor( String key ) 329 { 330 return ( Color ) _colors.get( key ); 331 } 332 static 333 { 334 335 _colors = new HashMap(); 336 337 for( int i = 0; i < data.length; i++ ) 338 { 339 Object row[] = data[i]; 340 _colors.put( row[0], row[1] ); 341 } 342 } 343 344 } 345 | Popular Tags |