public void styleColor(Formatter out, String attr, Color color) { XSSFColor xSSFColor = (XSSFColor) color; if (color == null || xSSFColor.isAuto()) return; byte[] rgb = xSSFColor.getRgb(); if (rgb == null) { return; } out.format(" %s: #%02x%02x%02x;%n", attr, rgb[0], rgb[1], rgb[2]); }