List of utility methods to do Color to Hex
String | toHex(Color c) to Hex String r = Integer.toHexString(c.getRed()); String g = Integer.toHexString(c.getGreen()); String b = Integer.toHexString(c.getBlue()); if (r.length() == 1) { r = "0" + r; if (g.length() == 1) { g = "0" + g; ... |
int | toHex(Color color) to Hex return toHex(color.getRed(), color.getGreen(), color.getBlue());
|
String | toHex(Color color) Returns a hex string for the given color in RGB format. int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); return String.format("%02x", r) + String.format("%02x", g) + String.format("%02x", b); |
String | toHex(Color color) to Hex return "#" + String.format("%02X", color.getRed()).toLowerCase() + String.format("%02X", color.getGreen()).toLowerCase() + String.format("%02X", color.getBlue()).toLowerCase(); |
String | toHex(Color color) to Hex return (toHex(color.getRed()) + toHex(color.getGreen()) + toHex(color.getBlue())).toUpperCase();
|
String | toHex(Color color) to Hex String alpha = pad(Integer.toHexString(color.getAlpha())); String red = pad(Integer.toHexString(color.getRed())); String green = pad(Integer.toHexString(color.getGreen())); String blue = pad(Integer.toHexString(color.getBlue())); return "#" + red + green + blue + alpha; |
String | toHex(Color color) Returns the color as hex string ("#RRGGBB" or "#AARRGGBB"). String result; if (color.getAlpha() < 255) result = "#" + toHex(color.getAlpha()) + toHex(color.getRed()) + toHex(color.getGreen()) + toHex(color.getBlue()); else result = "#" + toHex(color.getRed()) + toHex(color.getGreen()) + toHex(color.getBlue()); return result; |
String | toHex(java.awt.Color color) to Hex return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()); |
String | toHex0x(Color col) to Hexx return String.format("0x%02x%02x%02x", col.getRed(), col.getGreen(), col.getBlue()); |
String | toHexCode(String prefix, Color color) transforms the color of the request from java.awt.Color to the hexadecimal representation as in an OGC conform WMS-GetMap request (e.g. String r = Integer.toHexString(color.getRed()); if (r.length() < 2) r = "0" + r; String g = Integer.toHexString(color.getGreen()); if (g.length() < 2) g = "0" + g; String b = Integer.toHexString(color.getBlue()); if (b.length() < 2) ... |