/** * Get #ffffff html hex number for a colour * * @see #toHexString(int) * @param c * Color object whose html colour number you want as a string * @return # followed by exactly 6 hex digits */ public final static String toString ( Color c ) { String s = Integer.toHexString( c.getRGB() & 0xffffff ); if ( s.length() < 6 ) { // pad on left with zeros s = "000000".substring( 0, 6 - s.length() ) + s; } return '#' + s; }