val < 1 ? 1.055 * Math.pow(val, (1d / 2.4)) - 0.055 : 1;
}
*/
private static String XSSFColorToHTML(XSSFWorkbook book, XSSFColor color) {
if (color != null) {
final CTColor ctcolor = color.getCTColor();
if (ctcolor.isSetIndexed()) {
byte[] rgb = IndexedRGB.getRGB(color.getIndexed());
if (rgb != null) {
return "#"+ toHex(rgb[0])+ toHex(rgb[1])+ toHex(rgb[2]);
}
}
if (ctcolor.isSetRgb()) {
byte[] argb = ctcolor.isSetTint() ?
getRgbWithTint(color.getRgb(), color.getTint())/*color.getRgbWithTint()*/ : color.getRgb();
return argb.length > 3 ?
"#"+ toHex(argb[1])+ toHex(argb[2])+ toHex(argb[3])://ignore alpha
"#"+ toHex(argb[0])+ toHex(argb[1])+ toHex(argb[2]);
}
if (ctcolor.isSetTheme()) {
ThemesTable theme = book.getTheme();
if (theme != null) {
XSSFColor themecolor = theme.getThemeColor(color.getTheme());
if (themecolor != null) {
if (ctcolor.isSetTint()) {
themecolor.setTint(ctcolor.getTint());
}
return XSSFColorToHTML(book, themecolor); //recursive
}
}
}