List of utility methods to do Color to HTML
Color | attemptHTML(String colour) attempt HTML return htmlColours.get(colour.toLowerCase());
|
String | colourToHtmlString(Color colour) Converts a Color to an HTML String (#RRGGBB), ignoring transparency. if (colour == null) { return null; return String.format("#%06X", colour.getRGB() & 0x00FFFFFF); |
String | covertToHtmlColor(Color color) covert To Html Color return color == null ? null : "#" + to2BitHexString(color.getRed()) + to2BitHexString(color.getGreen()) + to2BitHexString(color.getBlue()); |
String | toHTMLColor(Color c) to HTML Color return "#" + Integer.toHexString(c.getRGB()).substring(2); |
String | toHTMLColor(Color c) Return the hexidecimal color from a java.awt.Color int color = c.getRGB(); color |= 0xff000000; String s = Integer.toHexString(color); return s.substring(2); |
String | toHtmlColor(Color color) Converts the color into a Hex representation suitable for HTML color attributes. String rgb = Integer.toHexString(color.getRGB()); return "#" + rgb.substring(2, rgb.length()); |
String | toHtmlColor(Color color) Converts an integer to an HTML color representation. String result = null; if (color != null) { char[] cars = new char[7]; cars[0] = '#'; toHex((byte) color.getRed(), cars, 1); toHex((byte) color.getGreen(), cars, 3); toHex((byte) color.getBlue(), cars, 5); return new String(cars); ... |
String | toHtmlHex(Color color) to Html Hex return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()); |
String | toHtmlRGB(Color col) to Html RGB String r = Integer.toHexString(col.getRed()); String g = Integer.toHexString(col.getGreen()); String b = Integer.toHexString(col.getBlue()); return "#" + (r.length() == 1 ? "0" + r : r) + (g.length() == 1 ? "0" + g : g) + (b.length() == 1 ? "0" + b : b); |
String | toHtmlString(Color color) Converts a color to a HTML color in the format #RRGGBB. return String.format("#%06X", color.getRGB() & 0xffffff); |