From c843dbd309a13ac1b576d76b33e2a0a5d3a227bc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 17 Oct 2019 10:27:58 +0100 Subject: [PATCH] JAL-3368 'web' colour parsing reinstated (for now) --- src/jalview/util/Platform.java | 75 +++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 68e6bb4..feb6bee 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -727,38 +727,51 @@ public class Platform { return null; } - // SwingJS can do this natively. Not implemented here because that would - // introduce capabilities into JalviewJS that are not in Jalview/Java. - switch (name.toLowerCase()) + + /* + * JSUtil provides code that will convert any web colour name to the + * AWT color; but preferred solution is to add these colours for Java + * also (preferably read from a resource file). + * NB there are some conflicts (differing colours for the same name) + * - see JAL-3368 + */ + /** + * @j2sNative + * + * return swingjs.JSUtil.getColorFromName$S(name); + */ { - 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; + 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; + } } } -- 1.7.10.2