issue JAL-3368 and JAL-3253-applet
[jalview.git] / src / jalview / util / ColorUtils.java
index 60129fb..3eb080b 100644 (file)
@@ -225,6 +225,7 @@ public class ColorUtils
       col = new Color(value);
     } catch (NumberFormatException ex)
     {
+      col = Platform.getColorFromName(colour);
     }
 
     if (col == null)
@@ -319,57 +320,8 @@ public class ColorUtils
    */
   public static Color getAWTColorFromName(String name)
   {
-    if (name == null)
-    {
-      return null;
-    }
-    Color col = null;
-    name = name.toLowerCase();
-
-    // or make a static map; or use reflection on the field name
-    switch (name)
-    {
-    case "black":
-      col = Color.black;
-      break;
-    case "blue":
-      col = Color.blue;
-      break;
-    case "cyan":
-      col = Color.cyan;
-      break;
-    case "darkgray":
-      col = Color.darkGray;
-      break;
-    case "gray":
-      col = Color.gray;
-      break;
-    case "green":
-      col = Color.green;
-      break;
-    case "lightgray":
-      col = Color.lightGray;
-      break;
-    case "magenta":
-      col = Color.magenta;
-      break;
-    case "orange":
-      col = Color.orange;
-      break;
-    case "pink":
-      col = Color.pink;
-      break;
-    case "red":
-      col = Color.red;
-      break;
-    case "white":
-      col = Color.white;
-      break;
-    case "yellow":
-      col = Color.yellow;
-      break;
-    }
-
-    return col;
+    return Platform.getColorFromName(name); // BH 2019 -- allows for wide range
+                                            // of JavaScript colors (for
+                                            // JavaScript only)
   }
 }