For e.g. xlsx cell back ground color 14277081 - rgb 252/213/180 (visual basic used: ActiveCell.Interior.Color) the tint value is correct and also getRgb() delivers the correct value (byte array: [-9, -106, 70] - theme 9) without tint applied. But the value with the tint applied by getRgbWithTint() (XSSFColor internal private method applyTint()) delivers rgb 251/212/180 (byte array: [-5, -44, -76] - Hex: F79646). Other color value to reproduce is 14277081 (theme - 0).
Sorry, I mixed up some colors. Here's the corrected text: For e.g. xlsx cell back ground color 11851260 - rgb 252/213/180 (visual basic used: ActiveCell.Interior.Color) the tint value is correct and also getRgb() delivers the correct value (byte array: [-9, -106, 70] - Hex: F79646 - theme 9) without tint applied. But the value with the tint applied by getRgbWithTint() (XSSFColor internal private method applyTint()) delivers rgb 251/212/180 (byte array: [-5, -44, -76]). Other color value to reproduce () is 14277081 - rgb 217/217/217 (theme - 0). getRgb() delivers the correct value (byte array: [-1, -1, -1]) but getRgbWithTint() delivers byte array [0, 0, 0] even if the tint is -0.1499984740745262. If I apply the tint using your method from 3.9 manually I even receive 216/216/216. private static byte applyTint(int lum, double tint){ if(tint > 0){ return (byte)(lum * (1.0-tint) + (255 - 255 * (1.0-tint))); } else if (tint < 0){ return (byte)(lum*(1+tint)); } else { return (byte)lum; } }
Additionally for the second case I see XSSFColor.getRgb() delivers byte array [-1, -1, -1] where XSSFColor.getCTColor().getRgb() delivers [0, 0, 0]. This is the reason why getRgbWithTint() delivers [0, 0, 0] also. I applied tint with XSSFColor.getRgb().
This sounds similar to bug 54689
This may be a duplicate of bug 50787 or bug 59224. Can you verify that this issue still exists in the latest version of POI and is not a duplicate? If this is the case, please include a unit test to make it easier to verify this bug.
Closing - please reopen if you can reproduce this with latest POI release