List of utility methods to do Color Encode
String | encodeColorForCss(Color color) encode Color For Css if (null == color) { return "#000000"; return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()).toUpperCase(); |
String | encodeRGB(Color color) Encode to the color data type, see section 18.3.8 of OpenDocument-v1.2-part1. return "#" + Integer.toHexString(color.getRGB()).substring(2).toUpperCase(); |
String | encodeRGBHexString(Color color, boolean withAlpha) Create a string representation of the color in the format #RRGGBB or #RRGGBBAA if withAlpha is true.
if (color == null) { return null; StringBuilder colorString = new StringBuilder(withAlpha ? 9 : 7); colorString.append("#"); appendHexString(colorString, color.getRed()); appendHexString(colorString, color.getGreen()); appendHexString(colorString, color.getBlue()); ... |
String | encodeRGBIntString(Color color, boolean withAlpha) Create a string of the integer values of the RGB components of the color. if (color == null) { return null; StringBuilder colorString = new StringBuilder(); colorString.append(color.getRed()).append(",").append(color.getGreen()).append(",").append(color.getBlue()); if (withAlpha) { colorString.append(",").append(color.getAlpha()); return colorString.toString(); |