JAL-4265 Added --bgcolour for --structureimage output. Saves and restores Jmol state...
[jalview.git] / src / jalview / bin / Commands.java
index 3173b35..0565111 100644 (file)
@@ -678,6 +678,20 @@ public class Commands
                         .getColourScheme(af);
                 this.colourAlignFrame(af, imageColour);
 
+                List<String> extraCommands = new ArrayList<>();
+
+                String bgcolour = avm.getValueFromSubValOrArg(
+                        structureImageArgValue, Arg.BGCOLOUR,
+                        structureImageSubVals);
+                if (bgcolour != null && bgcolour.length() > 0)
+                {
+                  if (bgcolour.charAt(0) == '#')
+                  {
+                    bgcolour = "[x" + bgcolour.substring(1) + "]";
+                  }
+                  extraCommands.add("background " + bgcolour);
+                }
+
                 // TODO MAKE THIS VIEWER INDEPENDENT!!
                 switch (StructureViewer.getViewerType())
                 {
@@ -700,7 +714,7 @@ public class Commands
                       Console.debug(
                               "Rendering image to " + structureImageFile);
                       jmol.makePDBImage(structureImageFile, imageType,
-                              renderer, userBis);
+                              renderer, userBis, extraCommands);
                       Console.debug("Finished Rendering image to "
                               + structureImageFile);