Please use this code instead, it will return the correct color of the 4th character, which is black, so red part is 0.
I have highlighted the changes in red.
The output of this code will be 0, which is correct.
String path = “F:\Shak-Data-RW\Downloads\formatting-test.xls”;
Workbook workbook = new Workbook(path);
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get(0);
FontSetting characters = cell.getCharacters();
FontSetting fontSetting = cell.characters(4, 1);
Color color = fontSetting.getFont().getColor();
int red = color.getR();
Actually, 255 means -1 if the byte is signed.
You should read unsigned byte, then you will get a value from 0-255.