I'd like to set the accent colors belonging to ST_SchemeColorVal
in Groovy.
Something like:
STSchemeColorVal.ACCENT_1 = new Color(0,0,0)
Is this possible? If yes, how?
I think you want to change the a:accent1 element in your theme part (or one of your theme parts), for example:
<a:theme name="Office Theme">
<a:themeElements>
<a:clrScheme name="Custom 1">
<a:dk1>
<a:srgbClr val="2F2B20"/>
</a:dk1>
<a:lt1>
<a:srgbClr val="FFFFFF"/>
</a:lt1>
<a:dk2>
<a:srgbClr val="675E47"/>
</a:dk2>
<a:lt2>
<a:srgbClr val="DFDCB7"/>
</a:lt2>
<a:accent1>
<a:srgbClr val="D6F23C"/>
</a:accent1>
<a:accent2>
<a:srgbClr val="9CBEBD"/>
</a:accent2>
:
<a:accent6>
<a:srgbClr val="B1A089"/>
</a:accent6>
<a:hlink>
<a:srgbClr val="D25814"/>
</a:hlink>
<a:folHlink>
<a:srgbClr val="849A0A"/>
</a:folHlink>
</a:clrScheme>
You need to get the theme part, then change the value of the relevant element.
Creating the content from scratch is a different question, but in Java would be something like:
org.docx4j.dml.ObjectFactory dmlObjectFactory = new org.docx4j.dml.ObjectFactory();
CTColorScheme colorscheme = dmlObjectFactory.createCTColorScheme();
this.getContents().getThemeElements().setClrScheme(colorscheme);
// Create object for accent1
CTColor color = dmlObjectFactory.createCTColor();
colorscheme.setAccent1(color);
// Create object for srgbClr
CTSRgbColor srgbcolor = dmlObjectFactory.createCTSRgbColor();
color.setSrgbClr(srgbcolor);
srgbcolor.setVal(your byte[])