List of utility methods to do Color to Hex
String | toHexColor(Color col) to Hex Color StringBuffer res = new StringBuffer(); res.append("#"); String val = Long.toHexString((long) col.getRGB() & 0xFFFFFF); for (int i = 0; i < (6 - val.length()); i++) res.append("0"); res.append(val); return res.toString(); |
String | toHexColor(Color col) to Hex Color return Integer.toHexString((col.getRGB() & 0xffffff) | 0x1000000).substring(1);
|
String | toHexColor(final Color color) Converts java.awt.Color object to hex string. final String red = pad(Integer.toHexString(color.getRed())); final String green = pad(Integer.toHexString(color.getGreen())); final String blue = pad(Integer.toHexString(color.getBlue())); final String alpha = pad(Integer.toHexString(color.getAlpha())); return red + green + blue + alpha; |
String | toHexColor(final Color color) Converts a given color to it's hexidecimal equivalent. return "#" + colorToHexCode(color); |
String | toHexString(Color c) Converts a color to its hexadecimal string representation for VzText e.g. String r = Integer.toHexString(c.getRed()); String g = Integer.toHexString(c.getGreen()); String b = Integer.toHexString(c.getBlue()); String a = Integer.toHexString(c.getAlpha()); if (r.length() == 1) r = "0" + r; if (g.length() == 1) g = "0" + g; ... |
String | toHexString(Color col) converts Color to hex String with RGB values byte r = (byte) col.getRed(); byte g = (byte) col.getGreen(); byte b = (byte) col.getBlue(); StringBuffer sb = new StringBuffer(8); sb.append(hexChar[(r & 0xf0) >>> 4]); sb.append(hexChar[r & 0x0f]); sb.append(hexChar[(g & 0xf0) >>> 4]); sb.append(hexChar[g & 0x0f]); ... |
String | toHexString(Color col) converts Color to hex String with RGB values byte r = (byte) col.getRed(); byte g = (byte) col.getGreen(); byte b = (byte) col.getBlue(); if (hexSB == null) hexSB = new StringBuilder(8); else hexSB.setLength(0); hexSB.append(hexChar[(r & 0xf0) >>> 4]); ... |
String | toHexString(Color color) to Hex String return String.format("#%06x", (color.getRGB() & 0x00ffffff)); |
String | toHexString(Color color) Produces a String representing the passed in color as a hex value (including the #) suitable for use in html. return "#" + ("" + Integer.toHexString(color.getRGB())).substring(2); |
String | toHexString(Color color) Converts a color to its hex representation (0xFFFFFF). if (color == null) { return null; StringBuilder str = new StringBuilder("0x"); if (color.getRed() < 16) { str.append('0'); str.append(Integer.toHexString(color.getRed())); ... |