Java Utililty Methods Hex to Color

List of utility methods to do Hex to Color

Description

The list of methods to do Hex to Color are organized into topic(s).

Method

ColorhexToColor(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;
ColorhexToColor(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;
...