scientificware / jdk

Read-only mirror of https://hg.openjdk.java.net/jdk/jdk
GNU General Public License v2.0
0 stars 0 forks source link

JDK-8292276 : Add named colors from CSS Color Module Level 4 #12

Open scientificware opened 2 years ago

scientificware commented 2 years ago

The purpose of this issue is to add the missing color names, keyword transparent and allow non lowercase <rgb()> or <rgba()> values in CSS.java.

This is referenced in Java Bug Database as

This is tracked in JBS as

Related Pull Request

Missing color names in CSS

CSS color names are defined by :
CSS Color Module Level 4
W3C Candidate Recommendation Snapshot, 5 July 2022
4.1 The <Color> syntax
5.1. The <color> syntax
5.7.1. Resolving sRGB values

While the function names and named colors are ASCII case-insensitive, the specified value does not preserve any mixed casing and is treated as being all lowercase.

6.1. The RGB functions: rgb() and rgba()
6.2. The RGB Hexadecimal Notations: #RRGGBB
7.1. Named Colors

CSS defines a large set of named colors, so that common colors can be written and read more easily. A <named-color> is written as an <ident>, accepted anywhere a <color> is. As usual for CSS-defined <ident>s, all of these keywords are ASCII case-insensitive.

7.3. The transparent keyword

Running with Java before the patch

java --version
openjdk 17.0.3 2022-04-19
OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06)
OpenJDK 64-Bit Server VM GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06, mixed mode, sharing)

Screenshot_20220811_165323

Running with Java after the patch

java --version
openjdk 20-internal 2023-03-21
OpenJDK Runtime Environment (build 20-internal-adhoc.scientificwaredev.jdk)
OpenJDK 64-Bit Server VM (build 20-internal-adhoc.scientificwaredev.jdk, mixed mode)

Screenshot_20220811_164734

Impacts of these modifications.

Details

Update Javadoc

  /**
   * Converts a color string such as "RED", "#NNN", "#NNNN", "#NNNNNN", "#NNNNNNNN" or
   * "rgb(rv gv bv)" or "rgba(rv gv bv / av)" to a Color.
   * <p>
   * N is a digit in radix-16. rv, gv, bv are decimal values between 0, 255 or percent value between 0%,
   * 100% and av a decimal value in between 0, 1 or a percent value between 0%, 100%.
   * <p>
   * Notes :
   * <ul>
   *   <li>This will only convert string colors using names, a 3, 4, 6, 8 digit hexadecimal notations or
   *         a rgb function as they are listed and described in the 
   *         <a href=https://www.w3.org/TR/css-color-4>CSS Color Module Level 4</a>;</li>
   *   <li>otherwise, it will return null.</li>
   *   <li>The method is case-insensitive.</li>
   *   <li>String argument must not contain leading and trailing white spaces.</li>
   * </ul>
   * <p>
   * The following code defines instances of the same color :
   * {@snippet lang="java" :
   *   import java.awt.Color;
   *   import javax.swing.text.html.StyleSheet;
   *   StyleSheet styleSheet = new StyleSheet();
   *   // An opaque lightseagreen
   *   Color color01 = styleSheet.stringToColor("Lightseagreen");
   *   Color color02 = styleSheet.stringToColor("LIGHTSEAGREEN");
   *   Color color03 = styleSheet.stringToColor("rgb(32 178 170)");
   *   Color color04 = styleSheet.stringToColor("rgb(32, 178, 170)");
   *   Color color05 = styleSheet.stringToColor("rgb(12.6% 69.9% 66.7%)");
   *   Color color06 = styleSheet.stringToColor("#20b2aa");
   *   // A slightly-transparent lightseagreen
   *   Color color07 = styleSheet.stringToColor("rgb(32 178 170 / 0.8)");
   *   Color color08 = styleSheet.stringToColor("rgba(32, 178, 170, 0.8)");
   *   Color color09 = styleSheet.stringToColor("rgb(32 178 170 / 80%)");
   *   Color color10 = styleSheet.stringToColor("rgba(12.6%, 69.9%, 66.7%, 80%)");
   *   Color color11 = styleSheet.stringToColor("rgb(12.6% 69.9% 66.7% / 80%)");
   *   Color color12 = styleSheet.stringToColor("#20b2aacc");
   * }
   * <p>
   * @param string color string such as "RED", "#NNNNNNNN" or a rgb function
   * @return the color
   */

Alternatives to the first PR : Performances are tested below.

All implementations are build with CSS_Java_Color_Generator_4_JDK.java application from /home/scientificwaredev/Documents/openjfx-compile-tests. Double click cssb.

Switch ... case statement.

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

Or if ... else statement but with direct RGB generation.

Clic to see the code /** * Convert a color string such as "RED" or "#NNNNNN" or "rgb(r, g, b)" * or "rgba(r, g, b, a)" to a Color. */ static Color stringToColor(String str) { Color color; if (str == null) return null; if (str.length() == 0) color = Color.black; else if (str.startsWith("rgb(")) color = parseRGB(str); else if (str.startsWith("rgba(")) color = parseRGBA(str); else if (str.charAt(0) == '#') color = hexToColor(str); else if (str.equalsIgnoreCase("Aliceblue")) color = new Color(240, 248, 255); else if (str.equalsIgnoreCase("Antiquewhite")) color = new Color(250, 235, 215); else if (str.equalsIgnoreCase("Aqua")) color = new Color(0, 255, 255); else if (str.equalsIgnoreCase("Aquamarine")) color = new Color(127, 255, 212); else if (str.equalsIgnoreCase("Azure")) color = new Color(240, 255, 255); else if (str.equalsIgnoreCase("Beige")) color = new Color(245, 245, 220); else if (str.equalsIgnoreCase("Bisque")) color = new Color(255, 228, 196); else if (str.equalsIgnoreCase("Black")) color = new Color(0, 0, 0); else if (str.equalsIgnoreCase("Blanchedalmond")) color = new Color(255, 235, 205); else if (str.equalsIgnoreCase("Blue")) color = new Color(0, 0, 255); else if (str.equalsIgnoreCase("Blueviolet")) color = new Color(138, 43, 226); else if (str.equalsIgnoreCase("Brown")) color = new Color(165, 42, 42); else if (str.equalsIgnoreCase("Burlywood")) color = new Color(222, 184, 135); else if (str.equalsIgnoreCase("Cadetblue")) color = new Color(95, 158, 160); else if (str.equalsIgnoreCase("Chartreuse")) color = new Color(127, 255, 0); else if (str.equalsIgnoreCase("Chocolate")) color = new Color(210, 105, 30); else if (str.equalsIgnoreCase("Coral")) color = new Color(255, 127, 80); else if (str.equalsIgnoreCase("Cornflowerblue")) color = new Color(100, 149, 237); else if (str.equalsIgnoreCase("Cornsilk")) color = new Color(255, 248, 220); else if (str.equalsIgnoreCase("Crimson")) color = new Color(220, 20, 60); else if (str.equalsIgnoreCase("Cyan")) color = new Color(0, 255, 255); else if (str.equalsIgnoreCase("Darkblue")) color = new Color(0, 0, 139); else if (str.equalsIgnoreCase("Darkcyan")) color = new Color(0, 139, 139); else if (str.equalsIgnoreCase("Darkgoldenrod")) color = new Color(184, 134, 11); else if (str.equalsIgnoreCase("Darkgray")) color = new Color(169, 169, 169); else if (str.equalsIgnoreCase("Darkgreen")) color = new Color(0, 100, 0); else if (str.equalsIgnoreCase("Darkgrey")) color = new Color(169, 169, 169); else if (str.equalsIgnoreCase("Darkkhaki")) color = new Color(189, 183, 107); else if (str.equalsIgnoreCase("Darkmagenta")) color = new Color(139, 0, 139); else if (str.equalsIgnoreCase("Darkolivegreen")) color = new Color(85, 107, 47); else if (str.equalsIgnoreCase("Darkorange")) color = new Color(255, 140, 0); else if (str.equalsIgnoreCase("Darkorchid")) color = new Color(153, 50, 204); else if (str.equalsIgnoreCase("Darkred")) color = new Color(139, 0, 0); else if (str.equalsIgnoreCase("Darksalmon")) color = new Color(233, 150, 122); else if (str.equalsIgnoreCase("Darkseagreen")) color = new Color(143, 188, 143); else if (str.equalsIgnoreCase("Darkslateblue")) color = new Color(72, 61, 139); else if (str.equalsIgnoreCase("Darkslategray")) color = new Color(47, 79, 79); else if (str.equalsIgnoreCase("Darkslategrey")) color = new Color(47, 79, 79); else if (str.equalsIgnoreCase("Darkturquoise")) color = new Color(0, 206, 209); else if (str.equalsIgnoreCase("Darkviolet")) color = new Color(148, 0, 211); else if (str.equalsIgnoreCase("Deeppink")) color = new Color(255, 20, 147); else if (str.equalsIgnoreCase("Deepskyblue")) color = new Color(0, 191, 255); else if (str.equalsIgnoreCase("Dimgray")) color = new Color(105, 105, 105); else if (str.equalsIgnoreCase("Dimgrey")) color = new Color(105, 105, 105); else if (str.equalsIgnoreCase("Dodgerblue")) color = new Color(30, 144, 255); else if (str.equalsIgnoreCase("Firebrick")) color = new Color(178, 34, 34); else if (str.equalsIgnoreCase("Floralwhite")) color = new Color(255, 250, 240); else if (str.equalsIgnoreCase("Forestgreen")) color = new Color(34, 139, 34); else if (str.equalsIgnoreCase("Fuchsia")) color = new Color(255, 0, 255); else if (str.equalsIgnoreCase("Gainsboro")) color = new Color(220, 220, 220); else if (str.equalsIgnoreCase("Ghostwhite")) color = new Color(248, 248, 255); else if (str.equalsIgnoreCase("Gold")) color = new Color(255, 215, 0); else if (str.equalsIgnoreCase("Goldenrod")) color = new Color(218, 165, 32); else if (str.equalsIgnoreCase("Gray")) color = new Color(128, 128, 128); else if (str.equalsIgnoreCase("Green")) color = new Color(0, 128, 0); else if (str.equalsIgnoreCase("Greenyellow")) color = new Color(173, 255, 47); else if (str.equalsIgnoreCase("Grey")) color = new Color(128, 128, 128); else if (str.equalsIgnoreCase("Honeydew")) color = new Color(240, 255, 240); else if (str.equalsIgnoreCase("Hotpink")) color = new Color(255, 105, 180); else if (str.equalsIgnoreCase("Indianred")) color = new Color(205, 92, 92); else if (str.equalsIgnoreCase("Indigo")) color = new Color(75, 0, 130); else if (str.equalsIgnoreCase("Ivory")) color = new Color(255, 255, 240); else if (str.equalsIgnoreCase("Khaki")) color = new Color(240, 230, 140); else if (str.equalsIgnoreCase("Lavender")) color = new Color(230, 230, 250); else if (str.equalsIgnoreCase("Lavenderblush")) color = new Color(255, 240, 245); else if (str.equalsIgnoreCase("Lawngreen")) color = new Color(124, 252, 0); else if (str.equalsIgnoreCase("Lemonchiffon")) color = new Color(255, 250, 205); else if (str.equalsIgnoreCase("Lightblue")) color = new Color(173, 216, 230); else if (str.equalsIgnoreCase("Lightcoral")) color = new Color(240, 128, 128); else if (str.equalsIgnoreCase("Lightcyan")) color = new Color(224, 255, 255); else if (str.equalsIgnoreCase("Lightgoldenrodyellow")) color = new Color(250, 250, 210); else if (str.equalsIgnoreCase("Lightgray")) color = new Color(211, 211, 211); else if (str.equalsIgnoreCase("Lightgreen")) color = new Color(144, 238, 144); else if (str.equalsIgnoreCase("Lightgrey")) color = new Color(211, 211, 211); else if (str.equalsIgnoreCase("Lightpink")) color = new Color(255, 182, 193); else if (str.equalsIgnoreCase("Lightsalmon")) color = new Color(255, 160, 122); else if (str.equalsIgnoreCase("Lightseagreen")) color = new Color(32, 178, 170); else if (str.equalsIgnoreCase("Lightskyblue")) color = new Color(135, 206, 250); else if (str.equalsIgnoreCase("Lightslategray")) color = new Color(119, 136, 153); else if (str.equalsIgnoreCase("Lightslategrey")) color = new Color(119, 136, 153); else if (str.equalsIgnoreCase("Lightsteelblue")) color = new Color(176, 196, 222); else if (str.equalsIgnoreCase("Lightyellow")) color = new Color(255, 255, 224); else if (str.equalsIgnoreCase("Lime")) color = new Color(0, 255, 0); else if (str.equalsIgnoreCase("Limegreen")) color = new Color(50, 205, 50); else if (str.equalsIgnoreCase("Linen")) color = new Color(250, 240, 230); else if (str.equalsIgnoreCase("Magenta")) color = new Color(255, 0, 255); else if (str.equalsIgnoreCase("Maroon")) color = new Color(128, 0, 0); else if (str.equalsIgnoreCase("Mediumaquamarine")) color = new Color(102, 205, 170); else if (str.equalsIgnoreCase("Mediumblue")) color = new Color(0, 0, 205); else if (str.equalsIgnoreCase("Mediumorchid")) color = new Color(186, 85, 211); else if (str.equalsIgnoreCase("Mediumpurple")) color = new Color(147, 112, 219); else if (str.equalsIgnoreCase("Mediumseagreen")) color = new Color(60, 179, 113); else if (str.equalsIgnoreCase("Mediumslateblue")) color = new Color(123, 104, 238); else if (str.equalsIgnoreCase("Mediumspringgreen")) color = new Color(0, 250, 154); else if (str.equalsIgnoreCase("Mediumturquoise")) color = new Color(72, 209, 204); else if (str.equalsIgnoreCase("Mediumvioletred")) color = new Color(199, 21, 133); else if (str.equalsIgnoreCase("Midnightblue")) color = new Color(25, 25, 112); else if (str.equalsIgnoreCase("Mintcream")) color = new Color(245, 255, 250); else if (str.equalsIgnoreCase("Mistyrose")) color = new Color(255, 228, 225); else if (str.equalsIgnoreCase("Moccasin")) color = new Color(255, 228, 181); else if (str.equalsIgnoreCase("Navajowhite")) color = new Color(255, 222, 173); else if (str.equalsIgnoreCase("Navy")) color = new Color(0, 0, 128); else if (str.equalsIgnoreCase("Oldlace")) color = new Color(253, 245, 230); else if (str.equalsIgnoreCase("Olive")) color = new Color(128, 128, 0); else if (str.equalsIgnoreCase("Olivedrab")) color = new Color(107, 142, 35); else if (str.equalsIgnoreCase("Orange")) color = new Color(255, 165, 0); else if (str.equalsIgnoreCase("Orangered")) color = new Color(255, 69, 0); else if (str.equalsIgnoreCase("Orchid")) color = new Color(218, 112, 214); else if (str.equalsIgnoreCase("Palegoldenrod")) color = new Color(238, 232, 170); else if (str.equalsIgnoreCase("Palegreen")) color = new Color(152, 251, 152); else if (str.equalsIgnoreCase("Paleturquoise")) color = new Color(175, 238, 238); else if (str.equalsIgnoreCase("Palevioletred")) color = new Color(219, 112, 147); else if (str.equalsIgnoreCase("Papayawhip")) color = new Color(255, 239, 213); else if (str.equalsIgnoreCase("Peachpuff")) color = new Color(255, 218, 185); else if (str.equalsIgnoreCase("Peru")) color = new Color(205, 133, 63); else if (str.equalsIgnoreCase("Pink")) color = new Color(255, 192, 203); else if (str.equalsIgnoreCase("Plum")) color = new Color(221, 160, 221); else if (str.equalsIgnoreCase("Powderblue")) color = new Color(176, 224, 230); else if (str.equalsIgnoreCase("Purple")) color = new Color(128, 0, 128); else if (str.equalsIgnoreCase("Rebeccapurple")) color = new Color(102, 51, 153); else if (str.equalsIgnoreCase("Red")) color = new Color(255, 0, 0); else if (str.equalsIgnoreCase("Rosybrown")) color = new Color(188, 143, 143); else if (str.equalsIgnoreCase("Royalblue")) color = new Color(65, 105, 225); else if (str.equalsIgnoreCase("Saddlebrown")) color = new Color(139, 69, 19); else if (str.equalsIgnoreCase("Salmon")) color = new Color(250, 128, 114); else if (str.equalsIgnoreCase("Sandybrown")) color = new Color(244, 164, 96); else if (str.equalsIgnoreCase("Seagreen")) color = new Color(46, 139, 87); else if (str.equalsIgnoreCase("Seashell")) color = new Color(255, 245, 238); else if (str.equalsIgnoreCase("Sienna")) color = new Color(160, 82, 45); else if (str.equalsIgnoreCase("Silver")) color = new Color(192, 192, 192); else if (str.equalsIgnoreCase("Skyblue")) color = new Color(135, 206, 235); else if (str.equalsIgnoreCase("Slateblue")) color = new Color(106, 90, 205); else if (str.equalsIgnoreCase("Slategray")) color = new Color(112, 128, 144); else if (str.equalsIgnoreCase("Slategrey")) color = new Color(112, 128, 144); else if (str.equalsIgnoreCase("Snow")) color = new Color(255, 250, 250); else if (str.equalsIgnoreCase("Springgreen")) color = new Color(0, 255, 127); else if (str.equalsIgnoreCase("Steelblue")) color = new Color(70, 130, 180); else if (str.equalsIgnoreCase("Tan")) color = new Color(210, 180, 140); else if (str.equalsIgnoreCase("Teal")) color = new Color(0, 128, 128); else if (str.equalsIgnoreCase("Thistle")) color = new Color(216, 191, 216); else if (str.equalsIgnoreCase("Tomato")) color = new Color(255, 99, 71); else if (str.equalsIgnoreCase("Turquoise")) color = new Color(64, 224, 208); else if (str.equalsIgnoreCase("Violet")) color = new Color(238, 130, 238); else if (str.equalsIgnoreCase("Wheat")) color = new Color(245, 222, 179); else if (str.equalsIgnoreCase("White")) color = new Color(255, 255, 255); else if (str.equalsIgnoreCase("Whitesmoke")) color = new Color(245, 245, 245); else if (str.equalsIgnoreCase("Yellow")) color = new Color(255, 255, 0); else if (str.equalsIgnoreCase("Yellowgreen")) color = new Color(154, 205, 50); else color = hexToColor(str); // sometimes get specified without leading # return color; }

Or TreeMap approach

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

Or a Simple Map

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

Or simple Map + new Color instance returned

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

Or an handmade binary tree.

Winner Level Nb tests in leaf Need to add a level Total Tests Need
0 149 150 1-149
1 75 76 1-75
2 38 38 3-40
3 19 20 4-22
4 10 10 5-14
5 5 6 6-10
🥇 6 3 4 7-9
7 2 2 8-9
8 1 - 9
Winner Level Nb tests in leaf Need to add a level Total Tests Need
0 148 148 1-148
1 74 74 2-75
2 37 38 3-39
3 19 20 4-22
4 10 10 5-14
5 5 6 6-10
🥇 6 3 4 7-9
7 2 2 8-9
8 1 - 9
Clic to see the code /** * The color yellowGreen. In the default sRGB space. * @since 19 */ public static final Color YELLOW_GREEN = yellowGreen; /** * Convert a color string such as "RED" or "#NNNNNN" or "rgb(r, g, b)" * or "rgba(r, g, b, a)" to a Color. */ static Color stringToColor(String str) { if (str == null) { return null; } else if (str.length() == 0) { return Color.black; } else if (str.startsWith("rgb(")) { return parseRGB(str); } else if (str.startsWith("rgba(")) { return parseRGBA(str); } else if (str.charAt(0) == '#') { return hexToColor(str); } else { Color color = colorNamed(str.toLowerCase(Locale.ROOT)); if (color != null){ return color; } return hexToColor(str); // sometimes get specified without leading # } } private static Color colorNamed(String str) { if (str.compareTo("lightpink") < 0){ if (str.compareTo("darkslategrey") < 0){ if (str.compareTo("crimson") < 0){ if (str.compareTo("blueviolet") < 0){ if (str.compareTo("beige") < 0){ if (str.compareTo("aquamarine") < 0){ if (str.equals("aliceblue")) return new Color(240, 248, 255); if (str.equals("antiquewhite")) return new Color(250, 235, 215); if (str.equals("aqua")) return new Color(0, 255, 255); } else { if (str.equals("aquamarine")) return new Color(127, 255, 212); if (str.equals("azure")) return new Color(240, 255, 255); } } else if (str.compareTo("blanchedalmond") < 0){ if (str.equals("beige")) return new Color(245, 245, 220); if (str.equals("bisque")) return new Color(255, 228, 196); if (str.equals("black")) return new Color(0, 0, 0); } else { if (str.equals("blanchedalmond")) return new Color(255, 235, 205); if (str.equals("blue")) return new Color(0, 0, 255); } } else if (str.compareTo("chocolate") < 0){ if (str.compareTo("cadetblue") < 0){ if (str.equals("blueviolet")) return new Color(138, 43, 226); if (str.equals("brown")) return new Color(165, 42, 42); if (str.equals("burlywood")) return new Color(222, 184, 135); } else { if (str.equals("cadetblue")) return new Color(95, 158, 160); if (str.equals("chartreuse")) return new Color(127, 255, 0); } } else if (str.compareTo("cornflowerblue") < 0){ if (str.equals("chocolate")) return new Color(210, 105, 30); if (str.equals("coral")) return new Color(255, 127, 80); } else { if (str.equals("cornflowerblue")) return new Color(100, 149, 237); if (str.equals("cornsilk")) return new Color(255, 248, 220); } } else if (str.compareTo("darkmagenta") < 0){ if (str.compareTo("darkgray") < 0){ if (str.compareTo("darkcyan") < 0){ if (str.equals("crimson")) return new Color(220, 20, 60); if (str.equals("cyan")) return new Color(0, 255, 255); if (str.equals("darkblue")) return new Color(0, 0, 139); } else { if (str.equals("darkcyan")) return new Color(0, 139, 139); if (str.equals("darkgoldenrod")) return new Color(184, 134, 11); } } else if (str.compareTo("darkgrey") < 0){ if (str.equals("darkgray")) return new Color(169, 169, 169); if (str.equals("darkgreen")) return new Color(0, 100, 0); } else { if (str.equals("darkgrey")) return new Color(169, 169, 169); if (str.equals("darkkhaki")) return new Color(189, 183, 107); } } else if (str.compareTo("darksalmon") < 0){ if (str.compareTo("darkorchid") < 0){ if (str.equals("darkmagenta")) return new Color(139, 0, 139); if (str.equals("darkolivegreen")) return new Color(85, 107, 47); if (str.equals("darkorange")) return new Color(255, 140, 0); } else { if (str.equals("darkorchid")) return new Color(153, 50, 204); if (str.equals("darkred")) return new Color(139, 0, 0); } } else if (str.compareTo("darkslateblue") < 0){ if (str.equals("darksalmon")) return new Color(233, 150, 122); if (str.equals("darkseagreen")) return new Color(143, 188, 143); } else { if (str.equals("darkslateblue")) return new Color(72, 61, 139); if (str.equals("darkslategray")) return new Color(47, 79, 79); } } else if (str.compareTo("grey") < 0){ if (str.compareTo("forestgreen") < 0){ if (str.compareTo("dimgray") < 0){ if (str.compareTo("deeppink") < 0){ if (str.equals("darkslategrey")) return new Color(47, 79, 79); if (str.equals("darkturquoise")) return new Color(0, 206, 209); if (str.equals("darkviolet")) return new Color(148, 0, 211); } else { if (str.equals("deeppink")) return new Color(255, 20, 147); if (str.equals("deepskyblue")) return new Color(0, 191, 255); } } else if (str.compareTo("firebrick") < 0){ if (str.equals("dimgray")) return new Color(105, 105, 105); if (str.equals("dimgrey")) return new Color(105, 105, 105); if (str.equals("dodgerblue")) return new Color(30, 144, 255); } else { if (str.equals("firebrick")) return new Color(178, 34, 34); if (str.equals("floralwhite")) return new Color(255, 250, 240); } } else if (str.compareTo("goldenrod") < 0){ if (str.compareTo("ghostwhite") < 0){ if (str.equals("forestgreen")) return new Color(34, 139, 34); if (str.equals("fuchsia")) return new Color(255, 0, 255); if (str.equals("gainsboro")) return new Color(220, 220, 220); } else { if (str.equals("ghostwhite")) return new Color(248, 248, 255); if (str.equals("gold")) return new Color(255, 215, 0); } } else if (str.compareTo("green") < 0){ if (str.equals("goldenrod")) return new Color(218, 165, 32); if (str.equals("gray")) return new Color(128, 128, 128); } else { if (str.equals("green")) return new Color(0, 128, 0); if (str.equals("greenyellow")) return new Color(173, 255, 47); } } else if (str.compareTo("lawngreen") < 0){ if (str.compareTo("ivory") < 0){ if (str.compareTo("indianred") < 0){ if (str.equals("grey")) return new Color(128, 128, 128); if (str.equals("honeydew")) return new Color(240, 255, 240); if (str.equals("hotpink")) return new Color(255, 105, 180); } else { if (str.equals("indianred")) return new Color(205, 92, 92); if (str.equals("indigo")) return new Color(75, 0, 130); } } else if (str.compareTo("lavender") < 0){ if (str.equals("ivory")) return new Color(255, 255, 240); if (str.equals("khaki")) return new Color(240, 230, 140); } else { if (str.equals("lavender")) return new Color(230, 230, 250); if (str.equals("lavenderblush")) return new Color(255, 240, 245); } } else if (str.compareTo("lightgoldenrodyellow") < 0){ if (str.compareTo("lightcoral") < 0){ if (str.equals("lawngreen")) return new Color(124, 252, 0); if (str.equals("lemonchiffon")) return new Color(255, 250, 205); if (str.equals("lightblue")) return new Color(173, 216, 230); } else { if (str.equals("lightcoral")) return new Color(240, 128, 128); if (str.equals("lightcyan")) return new Color(224, 255, 255); } } else if (str.compareTo("lightgreen") < 0){ if (str.equals("lightgoldenrodyellow")) return new Color(250, 250, 210); if (str.equals("lightgray")) return new Color(211, 211, 211); } else { if (str.equals("lightgreen")) return new Color(144, 238, 144); if (str.equals("lightgrey")) return new Color(211, 211, 211); } } else if (str.compareTo("palevioletred") < 0){ if (str.compareTo("mediumspringgreen") < 0){ if (str.compareTo("linen") < 0){ if (str.compareTo("lightslategrey") < 0){ if (str.compareTo("lightskyblue") < 0){ if (str.equals("lightpink")) return new Color(255, 182, 193); if (str.equals("lightsalmon")) return new Color(255, 160, 122); if (str.equals("lightseagreen")) return new Color(32, 178, 170); } else { if (str.equals("lightskyblue")) return new Color(135, 206, 250); if (str.equals("lightslategray")) return new Color(119, 136, 153); } } else if (str.compareTo("lime") < 0){ if (str.equals("lightslategrey")) return new Color(119, 136, 153); if (str.equals("lightsteelblue")) return new Color(176, 196, 222); if (str.equals("lightyellow")) return new Color(255, 255, 224); } else { if (str.equals("lime")) return new Color(0, 255, 0); if (str.equals("limegreen")) return new Color(50, 205, 50); } } else if (str.compareTo("mediumorchid") < 0){ if (str.compareTo("mediumaquamarine") < 0){ if (str.equals("linen")) return new Color(250, 240, 230); if (str.equals("magenta")) return new Color(255, 0, 255); if (str.equals("maroon")) return new Color(128, 0, 0); } else { if (str.equals("mediumaquamarine")) return new Color(102, 205, 170); if (str.equals("mediumblue")) return new Color(0, 0, 205); } } else if (str.compareTo("mediumseagreen") < 0){ if (str.equals("mediumorchid")) return new Color(186, 85, 211); if (str.equals("mediumpurple")) return new Color(147, 112, 219); } else { if (str.equals("mediumseagreen")) return new Color(60, 179, 113); if (str.equals("mediumslateblue")) return new Color(123, 104, 238); } } else if (str.compareTo("oldlace") < 0){ if (str.compareTo("mistyrose") < 0){ if (str.compareTo("midnightblue") < 0){ if (str.equals("mediumspringgreen")) return new Color(0, 250, 154); if (str.equals("mediumturquoise")) return new Color(72, 209, 204); if (str.equals("mediumvioletred")) return new Color(199, 21, 133); } else { if (str.equals("midnightblue")) return new Color(25, 25, 112); if (str.equals("mintcream")) return new Color(245, 255, 250); } } else if (str.compareTo("navajowhite") < 0){ if (str.equals("mistyrose")) return new Color(255, 228, 225); if (str.equals("moccasin")) return new Color(255, 228, 181); } else { if (str.equals("navajowhite")) return new Color(255, 222, 173); if (str.equals("navy")) return new Color(0, 0, 128); } } else if (str.compareTo("orchid") < 0){ if (str.compareTo("orange") < 0){ if (str.equals("oldlace")) return new Color(253, 245, 230); if (str.equals("olive")) return new Color(128, 128, 0); if (str.equals("olivedrab")) return new Color(107, 142, 35); } else { if (str.equals("orange")) return new Color(255, 165, 0); if (str.equals("orangered")) return new Color(255, 69, 0); } } else if (str.compareTo("palegreen") < 0){ if (str.equals("orchid")) return new Color(218, 112, 214); if (str.equals("palegoldenrod")) return new Color(238, 232, 170); } else { if (str.equals("palegreen")) return new Color(152, 251, 152); if (str.equals("paleturquoise")) return new Color(175, 238, 238); } } else if (str.compareTo("skyblue") < 0){ if (str.compareTo("rosybrown") < 0){ if (str.compareTo("plum") < 0){ if (str.compareTo("peru") < 0){ if (str.equals("palevioletred")) return new Color(219, 112, 147); if (str.equals("papayawhip")) return new Color(255, 239, 213); if (str.equals("peachpuff")) return new Color(255, 218, 185); } else { if (str.equals("peru")) return new Color(205, 133, 63); if (str.equals("pink")) return new Color(255, 192, 203); } } else if (str.compareTo("rebeccapurple") < 0){ if (str.equals("plum")) return new Color(221, 160, 221); if (str.equals("powderblue")) return new Color(176, 224, 230); if (str.equals("purple")) return new Color(128, 0, 128); } else { if (str.equals("rebeccapurple")) return new Color(102, 51, 153); if (str.equals("red")) return new Color(255, 0, 0); } } else if (str.compareTo("seagreen") < 0){ if (str.compareTo("salmon") < 0){ if (str.equals("rosybrown")) return new Color(188, 143, 143); if (str.equals("royalblue")) return new Color(65, 105, 225); if (str.equals("saddlebrown")) return new Color(139, 69, 19); } else { if (str.equals("salmon")) return new Color(250, 128, 114); if (str.equals("sandybrown")) return new Color(244, 164, 96); } } else if (str.compareTo("sienna") < 0){ if (str.equals("seagreen")) return new Color(46, 139, 87); if (str.equals("seashell")) return new Color(255, 245, 238); } else { if (str.equals("sienna")) return new Color(160, 82, 45); if (str.equals("silver")) return new Color(192, 192, 192); } } else if (str.compareTo("thistle") < 0){ if (str.compareTo("springgreen") < 0){ if (str.compareTo("slategrey") < 0){ if (str.equals("skyblue")) return new Color(135, 206, 235); if (str.equals("slateblue")) return new Color(106, 90, 205); if (str.equals("slategray")) return new Color(112, 128, 144); } else { if (str.equals("slategrey")) return new Color(112, 128, 144); if (str.equals("snow")) return new Color(255, 250, 250); } } else if (str.compareTo("tan") < 0){ if (str.equals("springgreen")) return new Color(0, 255, 127); if (str.equals("steelblue")) return new Color(70, 130, 180); } else { if (str.equals("tan")) return new Color(210, 180, 140); if (str.equals("teal")) return new Color(0, 128, 128); } } else if (str.compareTo("white") < 0){ if (str.compareTo("violet") < 0){ if (str.equals("thistle")) return new Color(216, 191, 216); if (str.equals("tomato")) return new Color(255, 99, 71); if (str.equals("turquoise")) return new Color(64, 224, 208); } else { if (str.equals("violet")) return new Color(238, 130, 238); if (str.equals("wheat")) return new Color(245, 222, 179); } } else if (str.compareTo("yellow") < 0){ if (str.equals("white")) return new Color(255, 255, 255); if (str.equals("whitesmoke")) return new Color(245, 245, 245); } else { if (str.equals("yellow")) return new Color(255, 255, 0); if (str.equals("yellowgreen")) return new Color(154, 205, 50); } return null; }

Push code to java.awt.Color ?

Finaly I think, this should be transfered to java.awt.Color with the creation of the named(String name) method. Making the code simplier :

Such proposition already rejected few years ago JDK-6921655 Additional java.awt.Color constants requested ...

Clic to see the code ``` /** * Convert a color string such as "RED" or "#NNNNNN" or "rgb(r, g, b)" * or "rgba(r, g, b, a)" to a Color. */ static Color stringToColor(String str) { Color color; if (str == null) return null; if (str.length() == 0) color = Color.black; else if (str.startsWith("rgb(")) color = parseRGB(str); else if (str.startsWith("rgba(")) color = parseRGBA(str); else if (str.charAt(0) == '#') color = hexToColor(str); else if ((color = Color.named(str)) == null) color = hexToColor(str); // return color; } ```

Color.java name declarations.

Fields

Clic to see the code ``` /** * The color aliceBlue. In the default sRGB space. * @since 19 */ public static final Color aliceBlue = new Color(240, 248, 255); /** * The color aliceBlue. In the default sRGB space. * @since 19 */ public static final Color ALICE_BLUE = aliceBlue; /** * The color antiqueWhite. In the default sRGB space. * @since 19 */ public static final Color antiqueWhite = new Color(250, 235, 215); /** * The color antiqueWhite. In the default sRGB space. * @since 19 */ public static final Color ANTIQUE_WHITE = antiqueWhite; /** * The color aqua. In the default sRGB space. * @since 19 */ public static final Color aqua = new Color(0, 255, 255); /** * The color aqua. In the default sRGB space. * @since 19 */ public static final Color AQUA = aqua; /** * The color aquaMarine. In the default sRGB space. * @since 19 */ public static final Color aquaMarine = new Color(127, 255, 212); /** * The color aquaMarine. In the default sRGB space. * @since 19 */ public static final Color AQUA_MARINE = aquaMarine; /** * The color azure. In the default sRGB space. * @since 19 */ public static final Color azure = new Color(240, 255, 255); /** * The color azure. In the default sRGB space. * @since 19 */ public static final Color AZURE = azure; /** * The color beige. In the default sRGB space. * @since 19 */ public static final Color beige = new Color(245, 245, 220); /** * The color beige. In the default sRGB space. * @since 19 */ public static final Color BEIGE = beige; /** * The color bisque. In the default sRGB space. * @since 19 */ public static final Color bisque = new Color(255, 228, 196); /** * The color bisque. In the default sRGB space. * @since 19 */ public static final Color BISQUE = bisque; /** * The color black. In the default sRGB space. */ public static final Color black = new Color(0, 0, 0); /** * The color black. In the default sRGB space. * @since 1.4 */ public static final Color BLACK = black; /** * The color blanchedAlmond. In the default sRGB space. * @since 19 */ public static final Color blanchedAlmond = new Color(255, 235, 205); /** * The color blanchedAlmond. In the default sRGB space. * @since 19 */ public static final Color BLANCHED_ALMOND = blanchedAlmond; /** * The color blue. In the default sRGB space. */ public static final Color blue = new Color(0, 0, 255); /** * The color blue. In the default sRGB space. * @since 1.4 */ public static final Color BLUE = blue; /** * The color blueViolet. In the default sRGB space. * @since 19 */ public static final Color blueViolet = new Color(138, 43, 226); /** * The color blueViolet. In the default sRGB space. * @since 19 */ public static final Color BLUE_VIOLET = blueViolet; /** * The color brown. In the default sRGB space. * @since 19 */ public static final Color brown = new Color(165, 42, 42); /** * The color brown. In the default sRGB space. * @since 19 */ public static final Color BROWN = brown; /** * The color burlywood. In the default sRGB space. * @since 19 */ public static final Color burlywood = new Color(222, 184, 135); /** * The color burlywood. In the default sRGB space. * @since 19 */ public static final Color BURLYWOOD = burlywood; /** * The color cadetBlue. In the default sRGB space. * @since 19 */ public static final Color cadetBlue = new Color(95, 158, 160); /** * The color cadetBlue. In the default sRGB space. * @since 19 */ public static final Color CADET_BLUE = cadetBlue; /** * The color chartreuse. In the default sRGB space. * @since 19 */ public static final Color chartreuse = new Color(127, 255, 0); /** * The color chartreuse. In the default sRGB space. * @since 19 */ public static final Color CHARTREUSE = chartreuse; /** * The color chocolate. In the default sRGB space. * @since 19 */ public static final Color chocolate = new Color(210, 105, 30); /** * The color chocolate. In the default sRGB space. * @since 19 */ public static final Color CHOCOLATE = chocolate; /** * The color coral. In the default sRGB space. * @since 19 */ public static final Color coral = new Color(255, 127, 80); /** * The color coral. In the default sRGB space. * @since 19 */ public static final Color CORAL = coral; /** * The color cornflowerBlue. In the default sRGB space. * @since 19 */ public static final Color cornflowerBlue = new Color(100, 149, 237); /** * The color cornflowerBlue. In the default sRGB space. * @since 19 */ public static final Color CORNFLOWER_BLUE = cornflowerBlue; /** * The color cornsilk. In the default sRGB space. * @since 19 */ public static final Color cornsilk = new Color(255, 248, 220); /** * The color cornsilk. In the default sRGB space. * @since 19 */ public static final Color CORNSILK = cornsilk; /** * The color crimson. In the default sRGB space. * @since 19 */ public static final Color crimson = new Color(220, 20, 60); /** * The color crimson. In the default sRGB space. * @since 19 */ public static final Color CRIMSON = crimson; /** * The color cyan. In the default sRGB space. */ public static final Color cyan = new Color(0, 255, 255); /** * The color cyan. In the default sRGB space. * @since 1.4 */ public static final Color CYAN = cyan; /** * The color darkBlue. In the default sRGB space. * @since 19 */ public static final Color darkBlue = new Color(0, 0, 139); /** * The color darkBlue. In the default sRGB space. * @since 19 */ public static final Color DARK_BLUE = darkBlue; /** * The color darkCyan. In the default sRGB space. * @since 19 */ public static final Color darkCyan = new Color(0, 139, 139); /** * The color darkCyan. In the default sRGB space. * @since 19 */ public static final Color DARK_CYAN = darkCyan; /** * The color darkGoldenrod. In the default sRGB space. * @since 19 */ public static final Color darkGoldenrod = new Color(184, 134, 11); /** * The color darkGoldenrod. In the default sRGB space. * @since 19 */ public static final Color DARK_GOLDENROD = darkGoldenrod; /** * The color darkGray. In the default sRGB space. * @since 19 */ public static final Color darkGray = new Color(169, 169, 169); /** * The color darkGray. In the default sRGB space. * @since 19 */ public static final Color DARK_GRAY = darkGray; /** * The color darkGreen. In the default sRGB space. * @since 19 */ public static final Color darkGreen = new Color(0, 100, 0); /** * The color darkGreen. In the default sRGB space. * @since 19 */ public static final Color DARK_GREEN = darkGreen; /** * The color darkGrey. In the default sRGB space. * @since 19 */ public static final Color darkGrey = new Color(169, 169, 169); /** * The color darkGrey. In the default sRGB space. * @since 19 */ public static final Color DARK_GREY = darkGrey; /** * The color darkKhaki. In the default sRGB space. * @since 19 */ public static final Color darkKhaki = new Color(189, 183, 107); /** * The color darkKhaki. In the default sRGB space. * @since 19 */ public static final Color DARK_KHAKI = darkKhaki; /** * The color darkMagenta. In the default sRGB space. * @since 19 */ public static final Color darkMagenta = new Color(139, 0, 139); /** * The color darkMagenta. In the default sRGB space. * @since 19 */ public static final Color DARK_MAGENTA = darkMagenta; /** * The color darkOliveGreen. In the default sRGB space. * @since 19 */ public static final Color darkOliveGreen = new Color(85, 107, 47); /** * The color darkOliveGreen. In the default sRGB space. * @since 19 */ public static final Color DARK_OLIVE_GREEN = darkOliveGreen; /** * The color darkOrange. In the default sRGB space. * @since 19 */ public static final Color darkOrange = new Color(255, 140, 0); /** * The color darkOrange. In the default sRGB space. * @since 19 */ public static final Color DARK_ORANGE = darkOrange; /** * The color darkOrchid. In the default sRGB space. * @since 19 */ public static final Color darkOrchid = new Color(153, 50, 204); /** * The color darkOrchid. In the default sRGB space. * @since 19 */ public static final Color DARK_ORCHID = darkOrchid; /** * The color darkRed. In the default sRGB space. * @since 19 */ public static final Color darkRed = new Color(139, 0, 0); /** * The color darkRed. In the default sRGB space. * @since 19 */ public static final Color DARK_RED = darkRed; /** * The color darkSalmon. In the default sRGB space. * @since 19 */ public static final Color darkSalmon = new Color(233, 150, 122); /** * The color darkSalmon. In the default sRGB space. * @since 19 */ public static final Color DARK_SALMON = darkSalmon; /** * The color darkSeaGreen. In the default sRGB space. * @since 19 */ public static final Color darkSeaGreen = new Color(143, 188, 143); /** * The color darkSeaGreen. In the default sRGB space. * @since 19 */ public static final Color DARK_SEA_GREEN = darkSeaGreen; /** * The color darkSlateBlue. In the default sRGB space. * @since 19 */ public static final Color darkSlateBlue = new Color(72, 61, 139); /** * The color darkSlateBlue. In the default sRGB space. * @since 19 */ public static final Color DARK_SLATE_BLUE = darkSlateBlue; /** * The color darkSlateGray. In the default sRGB space. * @since 19 */ public static final Color darkSlateGray = new Color(47, 79, 79); /** * The color darkSlateGray. In the default sRGB space. * @since 19 */ public static final Color DARK_SLATE_GRAY = darkSlateGray; /** * The color darkSlateGrey. In the default sRGB space. * @since 19 */ public static final Color darkSlateGrey = new Color(47, 79, 79); /** * The color darkSlateGrey. In the default sRGB space. * @since 19 */ public static final Color DARK_SLATE_GREY = darkSlateGrey; /** * The color darkTurquoise. In the default sRGB space. * @since 19 */ public static final Color darkTurquoise = new Color(0, 206, 209); /** * The color darkTurquoise. In the default sRGB space. * @since 19 */ public static final Color DARK_TURQUOISE = darkTurquoise; /** * The color darkViolet. In the default sRGB space. * @since 19 */ public static final Color darkViolet = new Color(148, 0, 211); /** * The color darkViolet. In the default sRGB space. * @since 19 */ public static final Color DARK_VIOLET = darkViolet; /** * The color deepPink. In the default sRGB space. * @since 19 */ public static final Color deepPink = new Color(255, 20, 147); /** * The color deepPink. In the default sRGB space. * @since 19 */ public static final Color DEEP_PINK = deepPink; /** * The color deepSkyBlue. In the default sRGB space. * @since 19 */ public static final Color deepSkyBlue = new Color(0, 191, 255); /** * The color deepSkyBlue. In the default sRGB space. * @since 19 */ public static final Color DEEP_SKY_BLUE = deepSkyBlue; /** * The color dimGray. In the default sRGB space. * @since 19 */ public static final Color dimGray = new Color(105, 105, 105); /** * The color dimGray. In the default sRGB space. * @since 19 */ public static final Color DIM_GRAY = dimGray; /** * The color dimGrey. In the default sRGB space. * @since 19 */ public static final Color dimGrey = new Color(105, 105, 105); /** * The color dimGrey. In the default sRGB space. * @since 19 */ public static final Color DIM_GREY = dimGrey; /** * The color dodgerBlue. In the default sRGB space. * @since 19 */ public static final Color dodgerBlue = new Color(30, 144, 255); /** * The color dodgerBlue. In the default sRGB space. * @since 19 */ public static final Color DODGER_BLUE = dodgerBlue; /** * The color firebrick. In the default sRGB space. * @since 19 */ public static final Color firebrick = new Color(178, 34, 34); /** * The color firebrick. In the default sRGB space. * @since 19 */ public static final Color FIREBRICK = firebrick; /** * The color floralWhite. In the default sRGB space. * @since 19 */ public static final Color floralWhite = new Color(255, 250, 240); /** * The color floralWhite. In the default sRGB space. * @since 19 */ public static final Color FLORAL_WHITE = floralWhite; /** * The color forestGreen. In the default sRGB space. * @since 19 */ public static final Color forestGreen = new Color(34, 139, 34); /** * The color forestGreen. In the default sRGB space. * @since 19 */ public static final Color FOREST_GREEN = forestGreen; /** * The color fuchsia. In the default sRGB space. * @since 19 */ public static final Color fuchsia = new Color(255, 0, 255); /** * The color fuchsia. In the default sRGB space. * @since 19 */ public static final Color FUCHSIA = fuchsia; /** * The color gainsboro. In the default sRGB space. * @since 19 */ public static final Color gainsboro = new Color(220, 220, 220); /** * The color gainsboro. In the default sRGB space. * @since 19 */ public static final Color GAINSBORO = gainsboro; /** * The color ghostWhite. In the default sRGB space. * @since 19 */ public static final Color ghostWhite = new Color(248, 248, 255); /** * The color ghostWhite. In the default sRGB space. * @since 19 */ public static final Color GHOST_WHITE = ghostWhite; /** * The color gold. In the default sRGB space. * @since 19 */ public static final Color gold = new Color(255, 215, 0); /** * The color gold. In the default sRGB space. * @since 19 */ public static final Color GOLD = gold; /** * The color goldenrod. In the default sRGB space. * @since 19 */ public static final Color goldenrod = new Color(218, 165, 32); /** * The color goldenrod. In the default sRGB space. * @since 19 */ public static final Color GOLDENROD = goldenrod; /** * The color gray. In the default sRGB space. */ public static final Color gray = new Color(128, 128, 128); /** * The color gray. In the default sRGB space. * @since 1.4 */ public static final Color GRAY = gray; /** * The color green. In the default sRGB space. */ public static final Color green = new Color(0, 128, 0); /** * The color green. In the default sRGB space. * @since 1.4 */ public static final Color GREEN = green; /** * The color greenYellow. In the default sRGB space. * @since 19 */ public static final Color greenYellow = new Color(173, 255, 47); /** * The color greenYellow. In the default sRGB space. * @since 19 */ public static final Color GREEN_YELLOW = greenYellow; /** * The color grey. In the default sRGB space. * @since 19 */ public static final Color grey = new Color(128, 128, 128); /** * The color grey. In the default sRGB space. * @since 19 */ public static final Color GREY = grey; /** * The color honeydew. In the default sRGB space. * @since 19 */ public static final Color honeydew = new Color(240, 255, 240); /** * The color honeydew. In the default sRGB space. * @since 19 */ public static final Color HONEYDEW = honeydew; /** * The color hotPink. In the default sRGB space. * @since 19 */ public static final Color hotPink = new Color(255, 105, 180); /** * The color hotPink. In the default sRGB space. * @since 19 */ public static final Color HOT_PINK = hotPink; /** * The color indianRed. In the default sRGB space. * @since 19 */ public static final Color indianRed = new Color(205, 92, 92); /** * The color indianRed. In the default sRGB space. * @since 19 */ public static final Color INDIAN_RED = indianRed; /** * The color indigo. In the default sRGB space. * @since 19 */ public static final Color indigo = new Color(75, 0, 130); /** * The color indigo. In the default sRGB space. * @since 19 */ public static final Color INDIGO = indigo; /** * The color ivory. In the default sRGB space. * @since 19 */ public static final Color ivory = new Color(255, 255, 240); /** * The color ivory. In the default sRGB space. * @since 19 */ public static final Color IVORY = ivory; /** * The color khaki. In the default sRGB space. * @since 19 */ public static final Color khaki = new Color(240, 230, 140); /** * The color khaki. In the default sRGB space. * @since 19 */ public static final Color KHAKI = khaki; /** * The color lavender. In the default sRGB space. * @since 19 */ public static final Color lavender = new Color(230, 230, 250); /** * The color lavender. In the default sRGB space. * @since 19 */ public static final Color LAVENDER = lavender; /** * The color lavenderBlush. In the default sRGB space. * @since 19 */ public static final Color lavenderBlush = new Color(255, 240, 245); /** * The color lavenderBlush. In the default sRGB space. * @since 19 */ public static final Color LAVENDER_BLUSH = lavenderBlush; /** * The color lawnGreen. In the default sRGB space. * @since 19 */ public static final Color lawnGreen = new Color(124, 252, 0); /** * The color lawnGreen. In the default sRGB space. * @since 19 */ public static final Color LAWN_GREEN = lawnGreen; /** * The color lemonChiffon. In the default sRGB space. * @since 19 */ public static final Color lemonChiffon = new Color(255, 250, 205); /** * The color lemonChiffon. In the default sRGB space. * @since 19 */ public static final Color LEMON_CHIFFON = lemonChiffon; /** * The color lightBlue. In the default sRGB space. * @since 19 */ public static final Color lightBlue = new Color(173, 216, 230); /** * The color lightBlue. In the default sRGB space. * @since 19 */ public static final Color LIGHT_BLUE = lightBlue; /** * The color lightCoral. In the default sRGB space. * @since 19 */ public static final Color lightCoral = new Color(240, 128, 128); /** * The color lightCoral. In the default sRGB space. * @since 19 */ public static final Color LIGHT_CORAL = lightCoral; /** * The color lightCyan. In the default sRGB space. * @since 19 */ public static final Color lightCyan = new Color(224, 255, 255); /** * The color lightCyan. In the default sRGB space. * @since 19 */ public static final Color LIGHT_CYAN = lightCyan; /** * The color lightGoldenrodYellow. In the default sRGB space. * @since 19 */ public static final Color lightGoldenrodYellow = new Color(250, 250, 210); /** * The color lightGoldenrodYellow. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GOLDENROD_YELLOW = lightGoldenrodYellow; /** * The color lightGray. In the default sRGB space. * @since 19 */ public static final Color lightGray = new Color(211, 211, 211); /** * The color lightGray. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GRAY = lightGray; /** * The color lightGreen. In the default sRGB space. * @since 19 */ public static final Color lightGreen = new Color(144, 238, 144); /** * The color lightGreen. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GREEN = lightGreen; /** * The color lightGrey. In the default sRGB space. * @since 19 */ public static final Color lightGrey = new Color(211, 211, 211); /** * The color lightGrey. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GREY = lightGrey; /** * The color lightPink. In the default sRGB space. * @since 19 */ public static final Color lightPink = new Color(255, 182, 193); /** * The color lightPink. In the default sRGB space. * @since 19 */ public static final Color LIGHT_PINK = lightPink; /** * The color lightSalmon. In the default sRGB space. * @since 19 */ public static final Color lightSalmon = new Color(255, 160, 122); /** * The color lightSalmon. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SALMON = lightSalmon; /** * The color lightSeaGreen. In the default sRGB space. * @since 19 */ public static final Color lightSeaGreen = new Color(32, 178, 170); /** * The color lightSeaGreen. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SEA_GREEN = lightSeaGreen; /** * The color lightSkyBlue. In the default sRGB space. * @since 19 */ public static final Color lightSkyBlue = new Color(135, 206, 250); /** * The color lightSkyBlue. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SKY_BLUE = lightSkyBlue; /** * The color lightSlateGray. In the default sRGB space. * @since 19 */ public static final Color lightSlateGray = new Color(119, 136, 153); /** * The color lightSlateGray. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SLATE_GRAY = lightSlateGray; /** * The color lightSlateGrey. In the default sRGB space. * @since 19 */ public static final Color lightSlateGrey = new Color(119, 136, 153); /** * The color lightSlateGrey. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SLATE_GREY = lightSlateGrey; /** * The color lightSteelBlue. In the default sRGB space. * @since 19 */ public static final Color lightSteelBlue = new Color(176, 196, 222); /** * The color lightSteelBlue. In the default sRGB space. * @since 19 */ public static final Color LIGHT_STEEL_BLUE = lightSteelBlue; /** * The color lightYellow. In the default sRGB space. * @since 19 */ public static final Color lightYellow = new Color(255, 255, 224); /** * The color lightYellow. In the default sRGB space. * @since 19 */ public static final Color LIGHT_YELLOW = lightYellow; /** * The color lime. In the default sRGB space. * @since 19 */ public static final Color lime = new Color(0, 255, 0); /** * The color lime. In the default sRGB space. * @since 19 */ public static final Color LIME = lime; /** * The color limeGreen. In the default sRGB space. * @since 19 */ public static final Color limeGreen = new Color(50, 205, 50); /** * The color limeGreen. In the default sRGB space. * @since 19 */ public static final Color LIME_GREEN = limeGreen; /** * The color linen. In the default sRGB space. * @since 19 */ public static final Color linen = new Color(250, 240, 230); /** * The color linen. In the default sRGB space. * @since 19 */ public static final Color LINEN = linen; /** * The color magenta. In the default sRGB space. */ public static final Color magenta = new Color(255, 0, 255); /** * The color magenta. In the default sRGB space. * @since 1.4 */ public static final Color MAGENTA = magenta; /** * The color maroon. In the default sRGB space. * @since 19 */ public static final Color maroon = new Color(128, 0, 0); /** * The color maroon. In the default sRGB space. * @since 19 */ public static final Color MAROON = maroon; /** * The color mediumAquamarine. In the default sRGB space. * @since 19 */ public static final Color mediumAquamarine = new Color(102, 205, 170); /** * The color mediumAquamarine. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_AQUAMARINE = mediumAquamarine; /** * The color mediumBlue. In the default sRGB space. * @since 19 */ public static final Color mediumBlue = new Color(0, 0, 205); /** * The color mediumBlue. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_BLUE = mediumBlue; /** * The color mediumOrchid. In the default sRGB space. * @since 19 */ public static final Color mediumOrchid = new Color(186, 85, 211); /** * The color mediumOrchid. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_ORCHID = mediumOrchid; /** * The color mediumPurple. In the default sRGB space. * @since 19 */ public static final Color mediumPurple = new Color(147, 112, 219); /** * The color mediumPurple. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_PURPLE = mediumPurple; /** * The color mediumSeaGreen. In the default sRGB space. * @since 19 */ public static final Color mediumSeaGreen = new Color(60, 179, 113); /** * The color mediumSeaGreen. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_SEA_GREEN = mediumSeaGreen; /** * The color mediumSlateBlue. In the default sRGB space. * @since 19 */ public static final Color mediumSlateBlue = new Color(123, 104, 238); /** * The color mediumSlateBlue. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_SLATE_BLUE = mediumSlateBlue; /** * The color mediumSpringGreen. In the default sRGB space. * @since 19 */ public static final Color mediumSpringGreen = new Color(0, 250, 154); /** * The color mediumSpringGreen. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_SPRING_GREEN = mediumSpringGreen; /** * The color mediumTurquoise. In the default sRGB space. * @since 19 */ public static final Color mediumTurquoise = new Color(72, 209, 204); /** * The color mediumTurquoise. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_TURQUOISE = mediumTurquoise; /** * The color mediumVioletRed. In the default sRGB space. * @since 19 */ public static final Color mediumVioletRed = new Color(199, 21, 133); /** * The color mediumVioletRed. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_VIOLET_RED = mediumVioletRed; /** * The color midnightblue. In the default sRGB space. * @since 19 */ public static final Color midnightblue = new Color(25, 25, 112); /** * The color midnightblue. In the default sRGB space. * @since 19 */ public static final Color MIDNIGHTBLUE = midnightblue; /** * The color mintCream. In the default sRGB space. * @since 19 */ public static final Color mintCream = new Color(245, 255, 250); /** * The color mintCream. In the default sRGB space. * @since 19 */ public static final Color MINT_CREAM = mintCream; /** * The color mistyRose. In the default sRGB space. * @since 19 */ public static final Color mistyRose = new Color(255, 228, 225); /** * The color mistyRose. In the default sRGB space. * @since 19 */ public static final Color MISTY_ROSE = mistyRose; /** * The color moccasin. In the default sRGB space. * @since 19 */ public static final Color moccasin = new Color(255, 228, 181); /** * The color moccasin. In the default sRGB space. * @since 19 */ public static final Color MOCCASIN = moccasin; /** * The color navajoWhite. In the default sRGB space. * @since 19 */ public static final Color navajoWhite = new Color(255, 222, 173); /** * The color navajoWhite. In the default sRGB space. * @since 19 */ public static final Color NAVAJO_WHITE = navajoWhite; /** * The color navy. In the default sRGB space. * @since 19 */ public static final Color navy = new Color(0, 0, 128); /** * The color navy. In the default sRGB space. * @since 19 */ public static final Color NAVY = navy; /** * The color oldLace. In the default sRGB space. * @since 19 */ public static final Color oldLace = new Color(253, 245, 230); /** * The color oldLace. In the default sRGB space. * @since 19 */ public static final Color OLD_LACE = oldLace; /** * The color olive. In the default sRGB space. * @since 19 */ public static final Color olive = new Color(128, 128, 0); /** * The color olive. In the default sRGB space. * @since 19 */ public static final Color OLIVE = olive; /** * The color oliveDrab. In the default sRGB space. * @since 19 */ public static final Color oliveDrab = new Color(107, 142, 35); /** * The color oliveDrab. In the default sRGB space. * @since 19 */ public static final Color OLIVE_DRAB = oliveDrab; /** * The color orange. In the default sRGB space. */ public static final Color orange = new Color(255, 165, 0); /** * The color orange. In the default sRGB space. * @since 1.4 */ public static final Color ORANGE = orange; /** * The color orangeRed. In the default sRGB space. * @since 19 */ public static final Color orangeRed = new Color(255, 69, 0); /** * The color orangeRed. In the default sRGB space. * @since 19 */ public static final Color ORANGE_RED = orangeRed; /** * The color orchid. In the default sRGB space. * @since 19 */ public static final Color orchid = new Color(218, 112, 214); /** * The color orchid. In the default sRGB space. * @since 19 */ public static final Color ORCHID = orchid; /** * The color paleGoldenrod. In the default sRGB space. * @since 19 */ public static final Color paleGoldenrod = new Color(238, 232, 170); /** * The color paleGoldenrod. In the default sRGB space. * @since 19 */ public static final Color PALE_GOLDENROD = paleGoldenrod; /** * The color paleGreen. In the default sRGB space. * @since 19 */ public static final Color paleGreen = new Color(152, 251, 152); /** * The color paleGreen. In the default sRGB space. * @since 19 */ public static final Color PALE_GREEN = paleGreen; /** * The color paleTurquoise. In the default sRGB space. * @since 19 */ public static final Color paleTurquoise = new Color(175, 238, 238); /** * The color paleTurquoise. In the default sRGB space. * @since 19 */ public static final Color PALE_TURQUOISE = paleTurquoise; /** * The color paleVioletRed. In the default sRGB space. * @since 19 */ public static final Color paleVioletRed = new Color(219, 112, 147); /** * The color paleVioletRed. In the default sRGB space. * @since 19 */ public static final Color PALE_VIOLET_RED = paleVioletRed; /** * The color papayaWhip. In the default sRGB space. * @since 19 */ public static final Color papayaWhip = new Color(255, 239, 213); /** * The color papayaWhip. In the default sRGB space. * @since 19 */ public static final Color PAPAYA_WHIP = papayaWhip; /** * The color peachPuff. In the default sRGB space. * @since 19 */ public static final Color peachPuff = new Color(255, 218, 185); /** * The color peachPuff. In the default sRGB space. * @since 19 */ public static final Color PEACH_PUFF = peachPuff; /** * The color peru. In the default sRGB space. * @since 19 */ public static final Color peru = new Color(205, 133, 63); /** * The color peru. In the default sRGB space. * @since 19 */ public static final Color PERU = peru; /** * The color pink. In the default sRGB space. */ public static final Color pink = new Color(255, 192, 203); /** * The color pink. In the default sRGB space. * @since 1.4 */ public static final Color PINK = pink; /** * The color plum. In the default sRGB space. * @since 19 */ public static final Color plum = new Color(221, 160, 221); /** * The color plum. In the default sRGB space. * @since 19 */ public static final Color PLUM = plum; /** * The color powderBlue. In the default sRGB space. * @since 19 */ public static final Color powderBlue = new Color(176, 224, 230); /** * The color powderBlue. In the default sRGB space. * @since 19 */ public static final Color POWDER_BLUE = powderBlue; /** * The color purple. In the default sRGB space. * @since 19 */ public static final Color purple = new Color(128, 0, 128); /** * The color purple. In the default sRGB space. * @since 19 */ public static final Color PURPLE = purple; /** * The color rebeccaPurple. In the default sRGB space. * @since 19 */ public static final Color rebeccaPurple = new Color(102, 51, 153); /** * The color rebeccaPurple. In the default sRGB space. * @since 19 */ public static final Color REBECCA_PURPLE = rebeccaPurple; /** * The color red. In the default sRGB space. */ public static final Color red = new Color(255, 0, 0); /** * The color red. In the default sRGB space. * @since 1.4 */ public static final Color RED = red; /** * The color rosyBrown. In the default sRGB space. * @since 19 */ public static final Color rosyBrown = new Color(188, 143, 143); /** * The color rosyBrown. In the default sRGB space. * @since 19 */ public static final Color ROSY_BROWN = rosyBrown; /** * The color royalBlue. In the default sRGB space. * @since 19 */ public static final Color royalBlue = new Color(65, 105, 225); /** * The color royalBlue. In the default sRGB space. * @since 19 */ public static final Color ROYAL_BLUE = royalBlue; /** * The color saddleBrown. In the default sRGB space. * @since 19 */ public static final Color saddleBrown = new Color(139, 69, 19); /** * The color saddleBrown. In the default sRGB space. * @since 19 */ public static final Color SADDLE_BROWN = saddleBrown; /** * The color salmon. In the default sRGB space. * @since 19 */ public static final Color salmon = new Color(250, 128, 114); /** * The color salmon. In the default sRGB space. * @since 19 */ public static final Color SALMON = salmon; /** * The color sandyBrown. In the default sRGB space. * @since 19 */ public static final Color sandyBrown = new Color(244, 164, 96); /** * The color sandyBrown. In the default sRGB space. * @since 19 */ public static final Color SANDY_BROWN = sandyBrown; /** * The color seaGreen. In the default sRGB space. * @since 19 */ public static final Color seaGreen = new Color(46, 139, 87); /** * The color seaGreen. In the default sRGB space. * @since 19 */ public static final Color SEA_GREEN = seaGreen; /** * The color seashell. In the default sRGB space. * @since 19 */ public static final Color seashell = new Color(255, 245, 238); /** * The color seashell. In the default sRGB space. * @since 19 */ public static final Color SEASHELL = seashell; /** * The color sienna. In the default sRGB space. * @since 19 */ public static final Color sienna = new Color(160, 82, 45); /** * The color sienna. In the default sRGB space. * @since 19 */ public static final Color SIENNA = sienna; /** * The color silver. In the default sRGB space. * @since 19 */ public static final Color silver = new Color(192, 192, 192); /** * The color silver. In the default sRGB space. * @since 19 */ public static final Color SILVER = silver; /** * The color skyBlue. In the default sRGB space. * @since 19 */ public static final Color skyBlue = new Color(135, 206, 235); /** * The color skyBlue. In the default sRGB space. * @since 19 */ public static final Color SKY_BLUE = skyBlue; /** * The color slateBlue. In the default sRGB space. * @since 19 */ public static final Color slateBlue = new Color(106, 90, 205); /** * The color slateBlue. In the default sRGB space. * @since 19 */ public static final Color SLATE_BLUE = slateBlue; /** * The color slateGray. In the default sRGB space. * @since 19 */ public static final Color slateGray = new Color(112, 128, 144); /** * The color slateGray. In the default sRGB space. * @since 19 */ public static final Color SLATE_GRAY = slateGray; /** * The color slateGrey. In the default sRGB space. * @since 19 */ public static final Color slateGrey = new Color(112, 128, 144); /** * The color slateGrey. In the default sRGB space. * @since 19 */ public static final Color SLATE_GREY = slateGrey; /** * The color snow. In the default sRGB space. * @since 19 */ public static final Color snow = new Color(255, 250, 250); /** * The color snow. In the default sRGB space. * @since 19 */ public static final Color SNOW = snow; /** * The color springGreen. In the default sRGB space. * @since 19 */ public static final Color springGreen = new Color(0, 255, 127); /** * The color springGreen. In the default sRGB space. * @since 19 */ public static final Color SPRING_GREEN = springGreen; /** * The color steelBlue. In the default sRGB space. * @since 19 */ public static final Color steelBlue = new Color(70, 130, 180); /** * The color steelBlue. In the default sRGB space. * @since 19 */ public static final Color STEEL_BLUE = steelBlue; /** * The color tan. In the default sRGB space. * @since 19 */ public static final Color tan = new Color(210, 180, 140); /** * The color tan. In the default sRGB space. * @since 19 */ public static final Color TAN = tan; /** * The color teal. In the default sRGB space. * @since 19 */ public static final Color teal = new Color(0, 128, 128); /** * The color teal. In the default sRGB space. * @since 19 */ public static final Color TEAL = teal; /** * The color thistle. In the default sRGB space. * @since 19 */ public static final Color thistle = new Color(216, 191, 216); /** * The color thistle. In the default sRGB space. * @since 19 */ public static final Color THISTLE = thistle; /** * The color tomato. In the default sRGB space. * @since 19 */ public static final Color tomato = new Color(255, 99, 71); /** * The color tomato. In the default sRGB space. * @since 19 */ public static final Color TOMATO = tomato; /** * The color turquoise. In the default sRGB space. * @since 19 */ public static final Color turquoise = new Color(64, 224, 208); /** * The color turquoise. In the default sRGB space. * @since 19 */ public static final Color TURQUOISE = turquoise; /** * The color violet. In the default sRGB space. * @since 19 */ public static final Color violet = new Color(238, 130, 238); /** * The color violet. In the default sRGB space. * @since 19 */ public static final Color VIOLET = violet; /** * The color wheat. In the default sRGB space. * @since 19 */ public static final Color wheat = new Color(245, 222, 179); /** * The color wheat. In the default sRGB space. * @since 19 */ public static final Color WHEAT = wheat; /** * The color white. In the default sRGB space. */ public static final Color white = new Color(255, 255, 255); /** * The color white. In the default sRGB space. * @since 1.4 */ public static final Color WHITE = white; /** * The color whiteSmoke. In the default sRGB space. * @since 19 */ public static final Color whiteSmoke = new Color(245, 245, 245); /** * The color whiteSmoke. In the default sRGB space. * @since 19 */ public static final Color WHITE_SMOKE = whiteSmoke; /** * The color yellow. In the default sRGB space. */ public static final Color yellow = new Color(255, 255, 0); /** * The color yellow. In the default sRGB space. * @since 1.4 */ public static final Color YELLOW = yellow; /** * The color yellowGreen. In the default sRGB space. * @since 19 */ public static final Color yellowGreen = new Color(154, 205, 50); /** * The color yellowGreen. In the default sRGB space. * @since 19 */ public static final Color YELLOW_GREEN = yellowGreen; ```

Color.java named method :construction: Rewrite this using TreeMap or Map.

Method Summary

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

About performance

Run Nb Tests Current Impl. (ns) Case (ns) Hex Case (ns) RGB TreeMap (ns) RGB if ... else ... (ns) RGB if ... else ... (ns) Hex Map (ns) Map New Color (ns) Handmade BT (ns) Map New Color Lazy Init (ns)
Same Color Object :ballot_box_with_check: :ballot_box_with_check:
:1st_place_medal: :2nd_place_medal: :3rd_place_medal:
1 1 000 000 1 507 152 459 187 257 699 172 725 898 38 508 207 267 106 873 318 033 017 24 928 718 31 894 003 84 020 451 42 656 260
2 1 000 000 1 486 695 440 168 579 623 190 702 560 - 276 351 169 326 719 244 25 101 022 32 911 831 81 713 064 41 684 418
3 1 000 000 1 465 296 303 178 348 233 190 736 694 37 867 854 271 462 847 330 092 581 24 717 040 31 715 208 82 064 884 41 836 602
4 1 000 000 1 500 459 006 173 961 503 185 858 338 39 065 584 269 742 435 323 139 409 24 402 820 31 747 599 83 004 305 43 863 116
5 1 000 000 1 486 113 768 159 706 094 153 632 513 38 448 524 272 092 499 333 547 991 24 607 665 33 327 812 81 202 877 43 865 911

Differences in sRGB and hex definitions.

Name sRGB JDK Color.java sRGB CSS Level 4 hex CSS.java hex CSS Level 4
aqua Missing 0 255 255 = #00ffff
black = 0, 0, 0 = #000000
blue = 0, 0, 255 = #0000ff
cyan = 0, 255, 255 Missing #00ffff
darkgray 64, 64, 64 169, 169, 169 Missing #a9a9a9
fuchsia Missing 255, 0, 255 = #0000ff
gray = 128, 128, 128 = #808080
green 0, 255, 0 0, 128, 0 = #008000
lightGray 192, 192, 192 211, 211, 211 Missing #d3d3d3
Lime Missing 0, 255, 0 = #00ff00
magenta = 255, 0, 255 Missing #ff00ff
maroon Missing 128, 0, 0 = #800000
navy Missing 0, 0, 128 = #000080
olive Missing 128, 128, 0 = #808000
orange 255, 200, 0 255, 165, 0 #FF8000 #ffa500
pink 255, 175, 175 255, 192, 203 Missing #ffc0cb
purple missing 128, 0, 128 = #800080
red = 255, 0, 0 = #ff0000
silver Missing 192, 192, 192 = #c0c0c0
teal Missing 0, 128, 128 = #008080
white = 255, 255, 255 = #ffffff
yellow = 255, 255, 0 = #ffff00
13 17
ExE-Boss commented 2 years ago

Note that the switch expression needs to use str.toLowerCase(Locale.ROOT), otherwise any color containing the letter i will break when the current locale is Turkish (because "I".toLowerCase(Locale.forLanguageTag("tr")) returns "ı" and "i".toUpperCase(Locale.forLanguageTag("tr")) returns "İ")

scientificware commented 2 years ago

@ExE-Boss Done. Thanks. What is your preference ?

scientificware commented 2 years ago

Color.java name declarations.

Fields

Clic to see the code ``` /** * The color aliceBlue. In the default sRGB space. * @since 19 */ public static final Color aliceBlue = new Color(240, 248, 255); /** * The color aliceBlue. In the default sRGB space. * @since 19 */ public static final Color ALICE_BLUE = aliceBlue; /** * The color antiqueWhite. In the default sRGB space. * @since 19 */ public static final Color antiqueWhite = new Color(250, 235, 215); /** * The color antiqueWhite. In the default sRGB space. * @since 19 */ public static final Color ANTIQUE_WHITE = antiqueWhite; /** * The color aqua. In the default sRGB space. * @since 19 */ public static final Color aqua = new Color(0, 255, 255); /** * The color aqua. In the default sRGB space. * @since 19 */ public static final Color AQUA = aqua; /** * The color aquaMarine. In the default sRGB space. * @since 19 */ public static final Color aquaMarine = new Color(127, 255, 212); /** * The color aquaMarine. In the default sRGB space. * @since 19 */ public static final Color AQUA_MARINE = aquaMarine; /** * The color azure. In the default sRGB space. * @since 19 */ public static final Color azure = new Color(240, 255, 255); /** * The color azure. In the default sRGB space. * @since 19 */ public static final Color AZURE = azure; /** * The color beige. In the default sRGB space. * @since 19 */ public static final Color beige = new Color(245, 245, 220); /** * The color beige. In the default sRGB space. * @since 19 */ public static final Color BEIGE = beige; /** * The color bisque. In the default sRGB space. * @since 19 */ public static final Color bisque = new Color(255, 228, 196); /** * The color bisque. In the default sRGB space. * @since 19 */ public static final Color BISQUE = bisque; /** * The color black. In the default sRGB space. */ public static final Color black = new Color(0, 0, 0); /** * The color black. In the default sRGB space. * @since 1.4 */ public static final Color BLACK = black; /** * The color blanchedAlmond. In the default sRGB space. * @since 19 */ public static final Color blanchedAlmond = new Color(255, 235, 205); /** * The color blanchedAlmond. In the default sRGB space. * @since 19 */ public static final Color BLANCHED_ALMOND = blanchedAlmond; /** * The color blue. In the default sRGB space. */ public static final Color blue = new Color(0, 0, 255); /** * The color blue. In the default sRGB space. * @since 1.4 */ public static final Color BLUE = blue; /** * The color blueViolet. In the default sRGB space. * @since 19 */ public static final Color blueViolet = new Color(138, 43, 226); /** * The color blueViolet. In the default sRGB space. * @since 19 */ public static final Color BLUE_VIOLET = blueViolet; /** * The color brown. In the default sRGB space. * @since 19 */ public static final Color brown = new Color(165, 42, 42); /** * The color brown. In the default sRGB space. * @since 19 */ public static final Color BROWN = brown; /** * The color burlywood. In the default sRGB space. * @since 19 */ public static final Color burlywood = new Color(222, 184, 135); /** * The color burlywood. In the default sRGB space. * @since 19 */ public static final Color BURLYWOOD = burlywood; /** * The color cadetBlue. In the default sRGB space. * @since 19 */ public static final Color cadetBlue = new Color(95, 158, 160); /** * The color cadetBlue. In the default sRGB space. * @since 19 */ public static final Color CADET_BLUE = cadetBlue; /** * The color chartreuse. In the default sRGB space. * @since 19 */ public static final Color chartreuse = new Color(127, 255, 0); /** * The color chartreuse. In the default sRGB space. * @since 19 */ public static final Color CHARTREUSE = chartreuse; /** * The color chocolate. In the default sRGB space. * @since 19 */ public static final Color chocolate = new Color(210, 105, 30); /** * The color chocolate. In the default sRGB space. * @since 19 */ public static final Color CHOCOLATE = chocolate; /** * The color coral. In the default sRGB space. * @since 19 */ public static final Color coral = new Color(255, 127, 80); /** * The color coral. In the default sRGB space. * @since 19 */ public static final Color CORAL = coral; /** * The color cornflowerBlue. In the default sRGB space. * @since 19 */ public static final Color cornflowerBlue = new Color(100, 149, 237); /** * The color cornflowerBlue. In the default sRGB space. * @since 19 */ public static final Color CORNFLOWER_BLUE = cornflowerBlue; /** * The color cornsilk. In the default sRGB space. * @since 19 */ public static final Color cornsilk = new Color(255, 248, 220); /** * The color cornsilk. In the default sRGB space. * @since 19 */ public static final Color CORNSILK = cornsilk; /** * The color crimson. In the default sRGB space. * @since 19 */ public static final Color crimson = new Color(220, 20, 60); /** * The color crimson. In the default sRGB space. * @since 19 */ public static final Color CRIMSON = crimson; /** * The color cyan. In the default sRGB space. */ public static final Color cyan = new Color(0, 255, 255); /** * The color cyan. In the default sRGB space. * @since 1.4 */ public static final Color CYAN = cyan; /** * The color darkBlue. In the default sRGB space. * @since 19 */ public static final Color darkBlue = new Color(0, 0, 139); /** * The color darkBlue. In the default sRGB space. * @since 19 */ public static final Color DARK_BLUE = darkBlue; /** * The color darkCyan. In the default sRGB space. * @since 19 */ public static final Color darkCyan = new Color(0, 139, 139); /** * The color darkCyan. In the default sRGB space. * @since 19 */ public static final Color DARK_CYAN = darkCyan; /** * The color darkGoldenrod. In the default sRGB space. * @since 19 */ public static final Color darkGoldenrod = new Color(184, 134, 11); /** * The color darkGoldenrod. In the default sRGB space. * @since 19 */ public static final Color DARK_GOLDENROD = darkGoldenrod; /** * The color darkGray. In the default sRGB space. * @since 19 */ public static final Color darkGray = new Color(169, 169, 169); /** * The color darkGray. In the default sRGB space. * @since 19 */ public static final Color DARK_GRAY = darkGray; /** * The color darkGreen. In the default sRGB space. * @since 19 */ public static final Color darkGreen = new Color(0, 100, 0); /** * The color darkGreen. In the default sRGB space. * @since 19 */ public static final Color DARK_GREEN = darkGreen; /** * The color darkGrey. In the default sRGB space. * @since 19 */ public static final Color darkGrey = new Color(169, 169, 169); /** * The color darkGrey. In the default sRGB space. * @since 19 */ public static final Color DARK_GREY = darkGrey; /** * The color darkKhaki. In the default sRGB space. * @since 19 */ public static final Color darkKhaki = new Color(189, 183, 107); /** * The color darkKhaki. In the default sRGB space. * @since 19 */ public static final Color DARK_KHAKI = darkKhaki; /** * The color darkMagenta. In the default sRGB space. * @since 19 */ public static final Color darkMagenta = new Color(139, 0, 139); /** * The color darkMagenta. In the default sRGB space. * @since 19 */ public static final Color DARK_MAGENTA = darkMagenta; /** * The color darkOliveGreen. In the default sRGB space. * @since 19 */ public static final Color darkOliveGreen = new Color(85, 107, 47); /** * The color darkOliveGreen. In the default sRGB space. * @since 19 */ public static final Color DARK_OLIVE_GREEN = darkOliveGreen; /** * The color darkOrange. In the default sRGB space. * @since 19 */ public static final Color darkOrange = new Color(255, 140, 0); /** * The color darkOrange. In the default sRGB space. * @since 19 */ public static final Color DARK_ORANGE = darkOrange; /** * The color darkOrchid. In the default sRGB space. * @since 19 */ public static final Color darkOrchid = new Color(153, 50, 204); /** * The color darkOrchid. In the default sRGB space. * @since 19 */ public static final Color DARK_ORCHID = darkOrchid; /** * The color darkRed. In the default sRGB space. * @since 19 */ public static final Color darkRed = new Color(139, 0, 0); /** * The color darkRed. In the default sRGB space. * @since 19 */ public static final Color DARK_RED = darkRed; /** * The color darkSalmon. In the default sRGB space. * @since 19 */ public static final Color darkSalmon = new Color(233, 150, 122); /** * The color darkSalmon. In the default sRGB space. * @since 19 */ public static final Color DARK_SALMON = darkSalmon; /** * The color darkSeaGreen. In the default sRGB space. * @since 19 */ public static final Color darkSeaGreen = new Color(143, 188, 143); /** * The color darkSeaGreen. In the default sRGB space. * @since 19 */ public static final Color DARK_SEA_GREEN = darkSeaGreen; /** * The color darkSlateBlue. In the default sRGB space. * @since 19 */ public static final Color darkSlateBlue = new Color(72, 61, 139); /** * The color darkSlateBlue. In the default sRGB space. * @since 19 */ public static final Color DARK_SLATE_BLUE = darkSlateBlue; /** * The color darkSlateGray. In the default sRGB space. * @since 19 */ public static final Color darkSlateGray = new Color(47, 79, 79); /** * The color darkSlateGray. In the default sRGB space. * @since 19 */ public static final Color DARK_SLATE_GRAY = darkSlateGray; /** * The color darkSlateGrey. In the default sRGB space. * @since 19 */ public static final Color darkSlateGrey = new Color(47, 79, 79); /** * The color darkSlateGrey. In the default sRGB space. * @since 19 */ public static final Color DARK_SLATE_GREY = darkSlateGrey; /** * The color darkTurquoise. In the default sRGB space. * @since 19 */ public static final Color darkTurquoise = new Color(0, 206, 209); /** * The color darkTurquoise. In the default sRGB space. * @since 19 */ public static final Color DARK_TURQUOISE = darkTurquoise; /** * The color darkViolet. In the default sRGB space. * @since 19 */ public static final Color darkViolet = new Color(148, 0, 211); /** * The color darkViolet. In the default sRGB space. * @since 19 */ public static final Color DARK_VIOLET = darkViolet; /** * The color deepPink. In the default sRGB space. * @since 19 */ public static final Color deepPink = new Color(255, 20, 147); /** * The color deepPink. In the default sRGB space. * @since 19 */ public static final Color DEEP_PINK = deepPink; /** * The color deepSkyBlue. In the default sRGB space. * @since 19 */ public static final Color deepSkyBlue = new Color(0, 191, 255); /** * The color deepSkyBlue. In the default sRGB space. * @since 19 */ public static final Color DEEP_SKY_BLUE = deepSkyBlue; /** * The color dimGray. In the default sRGB space. * @since 19 */ public static final Color dimGray = new Color(105, 105, 105); /** * The color dimGray. In the default sRGB space. * @since 19 */ public static final Color DIM_GRAY = dimGray; /** * The color dimGrey. In the default sRGB space. * @since 19 */ public static final Color dimGrey = new Color(105, 105, 105); /** * The color dimGrey. In the default sRGB space. * @since 19 */ public static final Color DIM_GREY = dimGrey; /** * The color dodgerBlue. In the default sRGB space. * @since 19 */ public static final Color dodgerBlue = new Color(30, 144, 255); /** * The color dodgerBlue. In the default sRGB space. * @since 19 */ public static final Color DODGER_BLUE = dodgerBlue; /** * The color firebrick. In the default sRGB space. * @since 19 */ public static final Color firebrick = new Color(178, 34, 34); /** * The color firebrick. In the default sRGB space. * @since 19 */ public static final Color FIREBRICK = firebrick; /** * The color floralWhite. In the default sRGB space. * @since 19 */ public static final Color floralWhite = new Color(255, 250, 240); /** * The color floralWhite. In the default sRGB space. * @since 19 */ public static final Color FLORAL_WHITE = floralWhite; /** * The color forestGreen. In the default sRGB space. * @since 19 */ public static final Color forestGreen = new Color(34, 139, 34); /** * The color forestGreen. In the default sRGB space. * @since 19 */ public static final Color FOREST_GREEN = forestGreen; /** * The color fuchsia. In the default sRGB space. * @since 19 */ public static final Color fuchsia = new Color(255, 0, 255); /** * The color fuchsia. In the default sRGB space. * @since 19 */ public static final Color FUCHSIA = fuchsia; /** * The color gainsboro. In the default sRGB space. * @since 19 */ public static final Color gainsboro = new Color(220, 220, 220); /** * The color gainsboro. In the default sRGB space. * @since 19 */ public static final Color GAINSBORO = gainsboro; /** * The color ghostWhite. In the default sRGB space. * @since 19 */ public static final Color ghostWhite = new Color(248, 248, 255); /** * The color ghostWhite. In the default sRGB space. * @since 19 */ public static final Color GHOST_WHITE = ghostWhite; /** * The color gold. In the default sRGB space. * @since 19 */ public static final Color gold = new Color(255, 215, 0); /** * The color gold. In the default sRGB space. * @since 19 */ public static final Color GOLD = gold; /** * The color goldenrod. In the default sRGB space. * @since 19 */ public static final Color goldenrod = new Color(218, 165, 32); /** * The color goldenrod. In the default sRGB space. * @since 19 */ public static final Color GOLDENROD = goldenrod; /** * The color gray. In the default sRGB space. */ public static final Color gray = new Color(128, 128, 128); /** * The color gray. In the default sRGB space. * @since 1.4 */ public static final Color GRAY = gray; /** * The color green. In the default sRGB space. */ public static final Color green = new Color(0, 128, 0); /** * The color green. In the default sRGB space. * @since 1.4 */ public static final Color GREEN = green; /** * The color greenYellow. In the default sRGB space. * @since 19 */ public static final Color greenYellow = new Color(173, 255, 47); /** * The color greenYellow. In the default sRGB space. * @since 19 */ public static final Color GREEN_YELLOW = greenYellow; /** * The color grey. In the default sRGB space. * @since 19 */ public static final Color grey = new Color(128, 128, 128); /** * The color grey. In the default sRGB space. * @since 19 */ public static final Color GREY = grey; /** * The color honeydew. In the default sRGB space. * @since 19 */ public static final Color honeydew = new Color(240, 255, 240); /** * The color honeydew. In the default sRGB space. * @since 19 */ public static final Color HONEYDEW = honeydew; /** * The color hotPink. In the default sRGB space. * @since 19 */ public static final Color hotPink = new Color(255, 105, 180); /** * The color hotPink. In the default sRGB space. * @since 19 */ public static final Color HOT_PINK = hotPink; /** * The color indianRed. In the default sRGB space. * @since 19 */ public static final Color indianRed = new Color(205, 92, 92); /** * The color indianRed. In the default sRGB space. * @since 19 */ public static final Color INDIAN_RED = indianRed; /** * The color indigo. In the default sRGB space. * @since 19 */ public static final Color indigo = new Color(75, 0, 130); /** * The color indigo. In the default sRGB space. * @since 19 */ public static final Color INDIGO = indigo; /** * The color ivory. In the default sRGB space. * @since 19 */ public static final Color ivory = new Color(255, 255, 240); /** * The color ivory. In the default sRGB space. * @since 19 */ public static final Color IVORY = ivory; /** * The color khaki. In the default sRGB space. * @since 19 */ public static final Color khaki = new Color(240, 230, 140); /** * The color khaki. In the default sRGB space. * @since 19 */ public static final Color KHAKI = khaki; /** * The color lavender. In the default sRGB space. * @since 19 */ public static final Color lavender = new Color(230, 230, 250); /** * The color lavender. In the default sRGB space. * @since 19 */ public static final Color LAVENDER = lavender; /** * The color lavenderBlush. In the default sRGB space. * @since 19 */ public static final Color lavenderBlush = new Color(255, 240, 245); /** * The color lavenderBlush. In the default sRGB space. * @since 19 */ public static final Color LAVENDER_BLUSH = lavenderBlush; /** * The color lawnGreen. In the default sRGB space. * @since 19 */ public static final Color lawnGreen = new Color(124, 252, 0); /** * The color lawnGreen. In the default sRGB space. * @since 19 */ public static final Color LAWN_GREEN = lawnGreen; /** * The color lemonChiffon. In the default sRGB space. * @since 19 */ public static final Color lemonChiffon = new Color(255, 250, 205); /** * The color lemonChiffon. In the default sRGB space. * @since 19 */ public static final Color LEMON_CHIFFON = lemonChiffon; /** * The color lightBlue. In the default sRGB space. * @since 19 */ public static final Color lightBlue = new Color(173, 216, 230); /** * The color lightBlue. In the default sRGB space. * @since 19 */ public static final Color LIGHT_BLUE = lightBlue; /** * The color lightCoral. In the default sRGB space. * @since 19 */ public static final Color lightCoral = new Color(240, 128, 128); /** * The color lightCoral. In the default sRGB space. * @since 19 */ public static final Color LIGHT_CORAL = lightCoral; /** * The color lightCyan. In the default sRGB space. * @since 19 */ public static final Color lightCyan = new Color(224, 255, 255); /** * The color lightCyan. In the default sRGB space. * @since 19 */ public static final Color LIGHT_CYAN = lightCyan; /** * The color lightGoldenrodYellow. In the default sRGB space. * @since 19 */ public static final Color lightGoldenrodYellow = new Color(250, 250, 210); /** * The color lightGoldenrodYellow. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GOLDENROD_YELLOW = lightGoldenrodYellow; /** * The color lightGray. In the default sRGB space. * @since 19 */ public static final Color lightGray = new Color(211, 211, 211); /** * The color lightGray. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GRAY = lightGray; /** * The color lightGreen. In the default sRGB space. * @since 19 */ public static final Color lightGreen = new Color(144, 238, 144); /** * The color lightGreen. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GREEN = lightGreen; /** * The color lightGrey. In the default sRGB space. * @since 19 */ public static final Color lightGrey = new Color(211, 211, 211); /** * The color lightGrey. In the default sRGB space. * @since 19 */ public static final Color LIGHT_GREY = lightGrey; /** * The color lightPink. In the default sRGB space. * @since 19 */ public static final Color lightPink = new Color(255, 182, 193); /** * The color lightPink. In the default sRGB space. * @since 19 */ public static final Color LIGHT_PINK = lightPink; /** * The color lightSalmon. In the default sRGB space. * @since 19 */ public static final Color lightSalmon = new Color(255, 160, 122); /** * The color lightSalmon. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SALMON = lightSalmon; /** * The color lightSeaGreen. In the default sRGB space. * @since 19 */ public static final Color lightSeaGreen = new Color(32, 178, 170); /** * The color lightSeaGreen. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SEA_GREEN = lightSeaGreen; /** * The color lightSkyBlue. In the default sRGB space. * @since 19 */ public static final Color lightSkyBlue = new Color(135, 206, 250); /** * The color lightSkyBlue. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SKY_BLUE = lightSkyBlue; /** * The color lightSlateGray. In the default sRGB space. * @since 19 */ public static final Color lightSlateGray = new Color(119, 136, 153); /** * The color lightSlateGray. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SLATE_GRAY = lightSlateGray; /** * The color lightSlateGrey. In the default sRGB space. * @since 19 */ public static final Color lightSlateGrey = new Color(119, 136, 153); /** * The color lightSlateGrey. In the default sRGB space. * @since 19 */ public static final Color LIGHT_SLATE_GREY = lightSlateGrey; /** * The color lightSteelBlue. In the default sRGB space. * @since 19 */ public static final Color lightSteelBlue = new Color(176, 196, 222); /** * The color lightSteelBlue. In the default sRGB space. * @since 19 */ public static final Color LIGHT_STEEL_BLUE = lightSteelBlue; /** * The color lightYellow. In the default sRGB space. * @since 19 */ public static final Color lightYellow = new Color(255, 255, 224); /** * The color lightYellow. In the default sRGB space. * @since 19 */ public static final Color LIGHT_YELLOW = lightYellow; /** * The color lime. In the default sRGB space. * @since 19 */ public static final Color lime = new Color(0, 255, 0); /** * The color lime. In the default sRGB space. * @since 19 */ public static final Color LIME = lime; /** * The color limeGreen. In the default sRGB space. * @since 19 */ public static final Color limeGreen = new Color(50, 205, 50); /** * The color limeGreen. In the default sRGB space. * @since 19 */ public static final Color LIME_GREEN = limeGreen; /** * The color linen. In the default sRGB space. * @since 19 */ public static final Color linen = new Color(250, 240, 230); /** * The color linen. In the default sRGB space. * @since 19 */ public static final Color LINEN = linen; /** * The color magenta. In the default sRGB space. */ public static final Color magenta = new Color(255, 0, 255); /** * The color magenta. In the default sRGB space. * @since 1.4 */ public static final Color MAGENTA = magenta; /** * The color maroon. In the default sRGB space. * @since 19 */ public static final Color maroon = new Color(128, 0, 0); /** * The color maroon. In the default sRGB space. * @since 19 */ public static final Color MAROON = maroon; /** * The color mediumAquamarine. In the default sRGB space. * @since 19 */ public static final Color mediumAquamarine = new Color(102, 205, 170); /** * The color mediumAquamarine. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_AQUAMARINE = mediumAquamarine; /** * The color mediumBlue. In the default sRGB space. * @since 19 */ public static final Color mediumBlue = new Color(0, 0, 205); /** * The color mediumBlue. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_BLUE = mediumBlue; /** * The color mediumOrchid. In the default sRGB space. * @since 19 */ public static final Color mediumOrchid = new Color(186, 85, 211); /** * The color mediumOrchid. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_ORCHID = mediumOrchid; /** * The color mediumPurple. In the default sRGB space. * @since 19 */ public static final Color mediumPurple = new Color(147, 112, 219); /** * The color mediumPurple. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_PURPLE = mediumPurple; /** * The color mediumSeaGreen. In the default sRGB space. * @since 19 */ public static final Color mediumSeaGreen = new Color(60, 179, 113); /** * The color mediumSeaGreen. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_SEA_GREEN = mediumSeaGreen; /** * The color mediumSlateBlue. In the default sRGB space. * @since 19 */ public static final Color mediumSlateBlue = new Color(123, 104, 238); /** * The color mediumSlateBlue. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_SLATE_BLUE = mediumSlateBlue; /** * The color mediumSpringGreen. In the default sRGB space. * @since 19 */ public static final Color mediumSpringGreen = new Color(0, 250, 154); /** * The color mediumSpringGreen. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_SPRING_GREEN = mediumSpringGreen; /** * The color mediumTurquoise. In the default sRGB space. * @since 19 */ public static final Color mediumTurquoise = new Color(72, 209, 204); /** * The color mediumTurquoise. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_TURQUOISE = mediumTurquoise; /** * The color mediumVioletRed. In the default sRGB space. * @since 19 */ public static final Color mediumVioletRed = new Color(199, 21, 133); /** * The color mediumVioletRed. In the default sRGB space. * @since 19 */ public static final Color MEDIUM_VIOLET_RED = mediumVioletRed; /** * The color midnightblue. In the default sRGB space. * @since 19 */ public static final Color midnightblue = new Color(25, 25, 112); /** * The color midnightblue. In the default sRGB space. * @since 19 */ public static final Color MIDNIGHTBLUE = midnightblue; /** * The color mintCream. In the default sRGB space. * @since 19 */ public static final Color mintCream = new Color(245, 255, 250); /** * The color mintCream. In the default sRGB space. * @since 19 */ public static final Color MINT_CREAM = mintCream; /** * The color mistyRose. In the default sRGB space. * @since 19 */ public static final Color mistyRose = new Color(255, 228, 225); /** * The color mistyRose. In the default sRGB space. * @since 19 */ public static final Color MISTY_ROSE = mistyRose; /** * The color moccasin. In the default sRGB space. * @since 19 */ public static final Color moccasin = new Color(255, 228, 181); /** * The color moccasin. In the default sRGB space. * @since 19 */ public static final Color MOCCASIN = moccasin; /** * The color navajoWhite. In the default sRGB space. * @since 19 */ public static final Color navajoWhite = new Color(255, 222, 173); /** * The color navajoWhite. In the default sRGB space. * @since 19 */ public static final Color NAVAJO_WHITE = navajoWhite; /** * The color navy. In the default sRGB space. * @since 19 */ public static final Color navy = new Color(0, 0, 128); /** * The color navy. In the default sRGB space. * @since 19 */ public static final Color NAVY = navy; /** * The color oldLace. In the default sRGB space. * @since 19 */ public static final Color oldLace = new Color(253, 245, 230); /** * The color oldLace. In the default sRGB space. * @since 19 */ public static final Color OLD_LACE = oldLace; /** * The color olive. In the default sRGB space. * @since 19 */ public static final Color olive = new Color(128, 128, 0); /** * The color olive. In the default sRGB space. * @since 19 */ public static final Color OLIVE = olive; /** * The color oliveDrab. In the default sRGB space. * @since 19 */ public static final Color oliveDrab = new Color(107, 142, 35); /** * The color oliveDrab. In the default sRGB space. * @since 19 */ public static final Color OLIVE_DRAB = oliveDrab; /** * The color orange. In the default sRGB space. */ public static final Color orange = new Color(255, 165, 0); /** * The color orange. In the default sRGB space. * @since 1.4 */ public static final Color ORANGE = orange; /** * The color orangeRed. In the default sRGB space. * @since 19 */ public static final Color orangeRed = new Color(255, 69, 0); /** * The color orangeRed. In the default sRGB space. * @since 19 */ public static final Color ORANGE_RED = orangeRed; /** * The color orchid. In the default sRGB space. * @since 19 */ public static final Color orchid = new Color(218, 112, 214); /** * The color orchid. In the default sRGB space. * @since 19 */ public static final Color ORCHID = orchid; /** * The color paleGoldenrod. In the default sRGB space. * @since 19 */ public static final Color paleGoldenrod = new Color(238, 232, 170); /** * The color paleGoldenrod. In the default sRGB space. * @since 19 */ public static final Color PALE_GOLDENROD = paleGoldenrod; /** * The color paleGreen. In the default sRGB space. * @since 19 */ public static final Color paleGreen = new Color(152, 251, 152); /** * The color paleGreen. In the default sRGB space. * @since 19 */ public static final Color PALE_GREEN = paleGreen; /** * The color paleTurquoise. In the default sRGB space. * @since 19 */ public static final Color paleTurquoise = new Color(175, 238, 238); /** * The color paleTurquoise. In the default sRGB space. * @since 19 */ public static final Color PALE_TURQUOISE = paleTurquoise; /** * The color paleVioletRed. In the default sRGB space. * @since 19 */ public static final Color paleVioletRed = new Color(219, 112, 147); /** * The color paleVioletRed. In the default sRGB space. * @since 19 */ public static final Color PALE_VIOLET_RED = paleVioletRed; /** * The color papayaWhip. In the default sRGB space. * @since 19 */ public static final Color papayaWhip = new Color(255, 239, 213); /** * The color papayaWhip. In the default sRGB space. * @since 19 */ public static final Color PAPAYA_WHIP = papayaWhip; /** * The color peachPuff. In the default sRGB space. * @since 19 */ public static final Color peachPuff = new Color(255, 218, 185); /** * The color peachPuff. In the default sRGB space. * @since 19 */ public static final Color PEACH_PUFF = peachPuff; /** * The color peru. In the default sRGB space. * @since 19 */ public static final Color peru = new Color(205, 133, 63); /** * The color peru. In the default sRGB space. * @since 19 */ public static final Color PERU = peru; /** * The color pink. In the default sRGB space. */ public static final Color pink = new Color(255, 192, 203); /** * The color pink. In the default sRGB space. * @since 1.4 */ public static final Color PINK = pink; /** * The color plum. In the default sRGB space. * @since 19 */ public static final Color plum = new Color(221, 160, 221); /** * The color plum. In the default sRGB space. * @since 19 */ public static final Color PLUM = plum; /** * The color powderBlue. In the default sRGB space. * @since 19 */ public static final Color powderBlue = new Color(176, 224, 230); /** * The color powderBlue. In the default sRGB space. * @since 19 */ public static final Color POWDER_BLUE = powderBlue; /** * The color purple. In the default sRGB space. * @since 19 */ public static final Color purple = new Color(128, 0, 128); /** * The color purple. In the default sRGB space. * @since 19 */ public static final Color PURPLE = purple; /** * The color rebeccaPurple. In the default sRGB space. * @since 19 */ public static final Color rebeccaPurple = new Color(102, 51, 153); /** * The color rebeccaPurple. In the default sRGB space. * @since 19 */ public static final Color REBECCA_PURPLE = rebeccaPurple; /** * The color red. In the default sRGB space. */ public static final Color red = new Color(255, 0, 0); /** * The color red. In the default sRGB space. * @since 1.4 */ public static final Color RED = red; /** * The color rosyBrown. In the default sRGB space. * @since 19 */ public static final Color rosyBrown = new Color(188, 143, 143); /** * The color rosyBrown. In the default sRGB space. * @since 19 */ public static final Color ROSY_BROWN = rosyBrown; /** * The color royalBlue. In the default sRGB space. * @since 19 */ public static final Color royalBlue = new Color(65, 105, 225); /** * The color royalBlue. In the default sRGB space. * @since 19 */ public static final Color ROYAL_BLUE = royalBlue; /** * The color saddleBrown. In the default sRGB space. * @since 19 */ public static final Color saddleBrown = new Color(139, 69, 19); /** * The color saddleBrown. In the default sRGB space. * @since 19 */ public static final Color SADDLE_BROWN = saddleBrown; /** * The color salmon. In the default sRGB space. * @since 19 */ public static final Color salmon = new Color(250, 128, 114); /** * The color salmon. In the default sRGB space. * @since 19 */ public static final Color SALMON = salmon; /** * The color sandyBrown. In the default sRGB space. * @since 19 */ public static final Color sandyBrown = new Color(244, 164, 96); /** * The color sandyBrown. In the default sRGB space. * @since 19 */ public static final Color SANDY_BROWN = sandyBrown; /** * The color seaGreen. In the default sRGB space. * @since 19 */ public static final Color seaGreen = new Color(46, 139, 87); /** * The color seaGreen. In the default sRGB space. * @since 19 */ public static final Color SEA_GREEN = seaGreen; /** * The color seashell. In the default sRGB space. * @since 19 */ public static final Color seashell = new Color(255, 245, 238); /** * The color seashell. In the default sRGB space. * @since 19 */ public static final Color SEASHELL = seashell; /** * The color sienna. In the default sRGB space. * @since 19 */ public static final Color sienna = new Color(160, 82, 45); /** * The color sienna. In the default sRGB space. * @since 19 */ public static final Color SIENNA = sienna; /** * The color silver. In the default sRGB space. * @since 19 */ public static final Color silver = new Color(192, 192, 192); /** * The color silver. In the default sRGB space. * @since 19 */ public static final Color SILVER = silver; /** * The color skyBlue. In the default sRGB space. * @since 19 */ public static final Color skyBlue = new Color(135, 206, 235); /** * The color skyBlue. In the default sRGB space. * @since 19 */ public static final Color SKY_BLUE = skyBlue; /** * The color slateBlue. In the default sRGB space. * @since 19 */ public static final Color slateBlue = new Color(106, 90, 205); /** * The color slateBlue. In the default sRGB space. * @since 19 */ public static final Color SLATE_BLUE = slateBlue; /** * The color slateGray. In the default sRGB space. * @since 19 */ public static final Color slateGray = new Color(112, 128, 144); /** * The color slateGray. In the default sRGB space. * @since 19 */ public static final Color SLATE_GRAY = slateGray; /** * The color slateGrey. In the default sRGB space. * @since 19 */ public static final Color slateGrey = new Color(112, 128, 144); /** * The color slateGrey. In the default sRGB space. * @since 19 */ public static final Color SLATE_GREY = slateGrey; /** * The color snow. In the default sRGB space. * @since 19 */ public static final Color snow = new Color(255, 250, 250); /** * The color snow. In the default sRGB space. * @since 19 */ public static final Color SNOW = snow; /** * The color springGreen. In the default sRGB space. * @since 19 */ public static final Color springGreen = new Color(0, 255, 127); /** * The color springGreen. In the default sRGB space. * @since 19 */ public static final Color SPRING_GREEN = springGreen; /** * The color steelBlue. In the default sRGB space. * @since 19 */ public static final Color steelBlue = new Color(70, 130, 180); /** * The color steelBlue. In the default sRGB space. * @since 19 */ public static final Color STEEL_BLUE = steelBlue; /** * The color tan. In the default sRGB space. * @since 19 */ public static final Color tan = new Color(210, 180, 140); /** * The color tan. In the default sRGB space. * @since 19 */ public static final Color TAN = tan; /** * The color teal. In the default sRGB space. * @since 19 */ public static final Color teal = new Color(0, 128, 128); /** * The color teal. In the default sRGB space. * @since 19 */ public static final Color TEAL = teal; /** * The color thistle. In the default sRGB space. * @since 19 */ public static final Color thistle = new Color(216, 191, 216); /** * The color thistle. In the default sRGB space. * @since 19 */ public static final Color THISTLE = thistle; /** * The color tomato. In the default sRGB space. * @since 19 */ public static final Color tomato = new Color(255, 99, 71); /** * The color tomato. In the default sRGB space. * @since 19 */ public static final Color TOMATO = tomato; /** * The color turquoise. In the default sRGB space. * @since 19 */ public static final Color turquoise = new Color(64, 224, 208); /** * The color turquoise. In the default sRGB space. * @since 19 */ public static final Color TURQUOISE = turquoise; /** * The color violet. In the default sRGB space. * @since 19 */ public static final Color violet = new Color(238, 130, 238); /** * The color violet. In the default sRGB space. * @since 19 */ public static final Color VIOLET = violet; /** * The color wheat. In the default sRGB space. * @since 19 */ public static final Color wheat = new Color(245, 222, 179); /** * The color wheat. In the default sRGB space. * @since 19 */ public static final Color WHEAT = wheat; /** * The color white. In the default sRGB space. */ public static final Color white = new Color(255, 255, 255); /** * The color white. In the default sRGB space. * @since 1.4 */ public static final Color WHITE = white; /** * The color whiteSmoke. In the default sRGB space. * @since 19 */ public static final Color whiteSmoke = new Color(245, 245, 245); /** * The color whiteSmoke. In the default sRGB space. * @since 19 */ public static final Color WHITE_SMOKE = whiteSmoke; /** * The color yellow. In the default sRGB space. */ public static final Color yellow = new Color(255, 255, 0); /** * The color yellow. In the default sRGB space. * @since 1.4 */ public static final Color YELLOW = yellow; /** * The color yellowGreen. In the default sRGB space. * @since 19 */ public static final Color yellowGreen = new Color(154, 205, 50); /** * The color yellowGreen. In the default sRGB space. * @since 19 */ public static final Color YELLOW_GREEN = yellowGreen; ```

Color.java named method :construction: Rewrite this using TreeMap or Map.

Method Summary

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

Consider this : 8286270: [java.desktop] Replace color search in XColors with a switch statement #7096.

scientificware commented 1 year ago

Add this subset hexadecimal color test to MissingColorNames.listNAMEetRGBA method :

Value Ret. Val. Before PR Ret. Val. after PR Expect. Val.
null null :green_circle:
# null null :green_circle:
#f java.awt.Color[r=0,g=0,b=15] + a=255 null :white_circle:
#f0 java.awt.Color[r=0,g=0,b=240] + a=255 null :white_circle:
#f0f java.awt.Color[r=255,g=0,b=255] + a=255 java.awt.Color[r=255,g=0,b=255] + a=255 :green_circle:
#f0f1 java.awt.Color[r=0,g=240,b=241] + a=255 java.awt.Color[r=255,g=0,b=255] + a=17 :white_circle:
#f0f10 java.awt.Color[r=15,g=15,b=16] + a=255 null :white_circle:
#f0f109 java.awt.Color[r=240,g=241,b=9] + a=255 java.awt.Color[r=240,g=241,b=9] + a=255 :green_circle:
#f0f1092 java.awt.Color[r=240,g=241,b=9] + a=255 null :white_circle:
#f0f10928 java.awt.Color[r=240,g=241,b=9] + a=255 java.awt.Color[r=240,g=241,b=153] + a=40 :white_circle:
f0f10928 null java.awt.Color[r=240,g=241,b=9] + a=40 :white_circle:
#f0f109289 java.awt.Color[r=240,g=241,b=9] + a=255 null :white_circle:
f0f109289 null null :green_circle:
ppabcdef null null :green_circle:
b52k null null :green_circle:
#ppabcdef null null :green_circle:
#b52k null null :green_circle:
#ffffffff java.awt.Color[r=255,g=255,b=255] + a=255 java.awt.Color[r=255,g=255,b=255] + a=255 :green_circle:
ffffffff null java.awt.Color[r=255,g=255,b=255] + a=255 :white_circle:
#ffffff java.awt.Color[r=255,g=255,b=255] + a=255 java.awt.Color[r=255,g=255,b=255] + a=255 :green_circle:
ffffff java.awt.Color[r=255,g=255,b=255] + a=255 java.awt.Color[r=255,g=255,b=255] + a=255 :green_circle:
scientificware commented 10 months ago