+
+ public static Color getAWTColorFromName(String name)
+ {
+ Color col = null;
+ name = name.toLowerCase();
+ if (name.equals("black"))
+ {
+ col = Color.black;
+ }
+ else if (name.equals("blue"))
+ {
+ col = Color.blue;
+ }
+ else if (name.equals("cyan"))
+ {
+ col = Color.cyan;
+ }
+ else if (name.equals("darkGray"))
+ {
+ col = Color.darkGray;
+ }
+ else if (name.equals("gray"))
+ {
+ col = Color.gray;
+ }
+ else if (name.equals("green"))
+ {
+ col = Color.green;
+ }
+ else if (name.equals("lightGray"))
+ {
+ col = Color.lightGray;
+ }
+ else if (name.equals("magenta"))
+ {
+ col = Color.magenta;
+ }
+ else if (name.equals("orange"))
+ {
+ col = Color.orange;
+ }
+ else if (name.equals("pink"))
+ {
+ col = Color.pink;
+ }
+ else if (name.equals("red"))
+ {
+ col = Color.red;
+ }
+ else if (name.equals("white"))
+ {
+ col = Color.white;
+ }
+ else if (name.equals("yellow"))
+ {
+ col = Color.yellow;
+ }
+
+ return col;
+ }
+
+ public static Color rnaHelices[] = null;
+
+ public static void initRnaHelicesShading(int n)
+ {
+ int j = 0;
+ if (rnaHelices == null)
+ {
+ rnaHelices = new Color[n + 1];
+ }
+ else if (rnaHelices != null && rnaHelices.length <= n)
+ {
+ Color[] t = new Color[n + 1];
+ System.arraycopy(rnaHelices, 0, t, 0, rnaHelices.length);
+ j = rnaHelices.length;
+ rnaHelices = t;
+ }
+ else
+ {
+ return;
+ }
+ // Generate random colors and store
+ for (; j <= n; j++)
+ {
+ rnaHelices[j] = jalview.util.ColorUtils
+ .generateRandomColor(Color.white);
+ }
+ }
+
+ /**
+ * delete the existing cached RNA helces colours
+ */
+ public static void resetRnaHelicesShading()
+ {
+ rnaHelices = null;
+ }
+