Pages

Sunday, January 08, 2012

CDK-JChemPaint #10: background color

I found in the Groovy JChemPaint repository a script I had not blogged about yet, explaining how to change the default background color. It's fairly simple, and just uses parameters. Starting from the common pattern to set up a renderer, you set the background parameter:

backgroundColor = Color.lightGray;
model = renderer.getRenderer2DModel()
model.set(
  BasicSceneGenerator.BackgroundColor.class,
  backgroundColor
)

The full script can be found here. The resulting output looks like that given below.