this.theme = theme;
}
public XSSFColor getThemeColor(int idx) {
CTColorScheme colorScheme = theme.getTheme().getThemeElements().getClrScheme();
CTColor ctColor = null;
int cnt = 0;
for (XmlObject obj : colorScheme.selectPath("./*")) {
if (obj instanceof org.openxmlformats.schemas.drawingml.x2006.main.CTColor) {
if (cnt == idx) {
ctColor = (org.openxmlformats.schemas.drawingml.x2006.main.CTColor) obj;
byte[] rgb = null;
if (ctColor.getSrgbClr() != null) {
// Colour is a regular one
rgb = ctColor.getSrgbClr().getVal();
} else if (ctColor.getSysClr() != null) {
// Colour is a tint of white or black
rgb = ctColor.getSysClr().getLastClr();
}
return new XSSFColor(rgb);
}
cnt++;