List of utility methods to do Hex to Color
Color | hexToColor(String string) hex To Color if (string.length() == 6) { int red = Integer.parseInt(string.substring(0, 2), 16); int green = Integer.parseInt(string.substring(2, 4), 16); int blue = Integer.parseInt(string.substring(4, 6), 16); return new Color(red, green, blue); } else { return null; |
Color | hexToColor(String value) Convert a "#FFFFFF" hex string to a Color. String digits; if (value.startsWith("#")) { digits = value.substring(1, Math.min(value.length(), 7)); } else { digits = value; String hstr = "0x" + digits; Color c; ... |