class ColorUtil {

    private ColorUtil() {
    }

    /**
     * Return Color object from string. The following formats are allowed:
     * {@code A1B2C3},
     * {@code abc123}
     *
     * @param str hex string
     * @return Color object
     */
    public static Color fromHex(String str) {<FILL_FUNCTION_BODY>}

    private static int parseHexNumber(String str, int pos) {
        return 16 * convertToDecimal(str, pos) + convertToDecimal(str, pos + 1);
    }

    private static int convertToDecimal(String str, int pos) {
        char ch = str.charAt(pos);
        if (ch >= '0' && ch <= '9') {
            return ch - '0';
        }
        if (ch >= 'A' && ch <= 'F') {
            return ch - 'A' + 10;
        }
        if (ch >= 'a' && ch <= 'f') {
            return ch - 'a' + 10;
        }
        throw new IllegalArgumentException("unsupported char at " + pos + ":" + str);
    }
}

        if (str.length() != 6) {
            throw new IllegalArgumentException("unsupported length:" + str);
        }

        return new Color(parseHexNumber(str, 0), parseHexNumber(str, 2), parseHexNumber(str, 4));
    
<no_super_class>