title: Creating custom color styles for an XSSFWorkbook in Apache POI 4.0
body: <p>To apply a custom color for an XSSFWorkbook in Apache POI 3.7 and below the following was possible:</p>
  
  <pre><code>java.awt.Color c = new java.awt.Color (1,2,3)
  XSSFCellStyle xcs = xssfWorkbook.createCellStyle();
  XSSFFont headerFont = xssfWorkbook.createFont();
  headerFont.setColor(new XSSFColor(c));
  xcs.setFont(headerFont);
  cell.setCellStyle(xcs);
  </code></pre>
  
  <p>In version 4.0 XSSFColor(java.awt.Color) got removed. It is still possible to 
  achieve the same, just with additional 'hackery':</p>
  
  <pre><code>XSSFColor xc = new XSSFColor();
  xc.setARGBHex(String.format("%02x%02x%02x",c.getRed(),c.getGreen(),c.getBlue())); 
  headerFont.setColor(xc);
  </code></pre>
  
  <p>But what is the 'proper' way to do this? Most of the XSSFColor methods involve an IndexedColorMap but I could not find any example for how this could be used for setting custom colors in an XSSFWorkbook.</p>