From: hansonr Date: Tue, 15 Oct 2019 10:14:14 +0000 (-0400) Subject: JAL-3368 JAL-2365 JAL-2642 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ce039b3f8a0b9a3a266838082a678821507ddcc3;p=jalview.git JAL-3368 JAL-2365 JAL-2642 --- diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index ffecebb..68e6bb4 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -715,8 +715,10 @@ public class Platform return Regex.perlCode(code); } - /** - * Convert a color name to a Color object. SwingJS can do this natively. + /** + * Convert a color name to a Color object. + * + * * @param c */ public static Color getColorFromName(String name) @@ -725,44 +727,38 @@ public class Platform { return null; } - /** - * @j2sNative - * - * return swingjs.JSUtil.getColorFromName$S(name); - */ + // SwingJS can do this natively. Not implemented here because that would + // introduce capabilities into JalviewJS that are not in Jalview/Java. + switch (name.toLowerCase()) { - // or make a static map; or use reflection on the field name - switch (name.toLowerCase()) - { - case "black": - return Color.black; - case "blue": - return Color.blue; - case "cyan": - return Color.cyan; - case "darkgray": - return Color.darkGray; - case "gray": - return Color.gray; - case "green": - return Color.green; - case "lightgray": - return Color.lightGray; - case "magenta": - return Color.magenta; - case "orange": - return Color.orange; - case "pink": - return Color.pink; - case "red": - return Color.red; - case "white": - return Color.white; - case "yellow": - return Color.yellow; - default: - return null; - } + case "black": + return Color.black; + case "blue": + return Color.blue; + case "cyan": + return Color.cyan; + case "darkgray": + return Color.darkGray; + case "gray": + return Color.gray; + case "green": + return Color.green; + case "lightgray": + return Color.lightGray; + case "magenta": + return Color.magenta; + case "orange": + return Color.orange; + case "pink": + return Color.pink; + case "red": + return Color.red; + case "white": + return Color.white; + case "yellow": + return Color.yellow; + default: + return null; } }