private int parseColor(String color) throws ImagingException {
        if (color.charAt(0) == '#') {
            color = color.substring(1);
            if (color.length() == 3) {
                final int red = Integer.parseInt(color.substring(0, 1), 16);
                final int green = Integer.parseInt(color.substring(1, 2), 16);
                final int blue = Integer.parseInt(color.substring(2, 3), 16);
                return 0xff000000 | red << 20 | green << 12 | blue << 4;
            }
            if (color.length() == 6) {
                return 0xff000000 | Integer.parseInt(color, 16);
            }
            if (color.length() == 9) {
                final int red = Integer.parseInt(color.substring(0, 1), 16);
                final int green = Integer.parseInt(color.substring(3, 4), 16);
                final int blue = Integer.parseInt(color.substring(6, 7), 16);
                return 0xff000000 | red << 16 | green << 8 | blue;
            }
            if (color.length() == 12) {
                final int red = Integer.parseInt(color.substring(0, 1), 16);
                final int green = Integer.parseInt(color.substring(4, 5), 16);
                final int blue = Integer.parseInt(color.substring(8, 9), 16);
                return 0xff000000 | red << 16 | green << 8 | blue;
            }
            if (color.length() == 24) {
                final int red = Integer.parseInt(color.substring(0, 1), 16);
                final int green = Integer.parseInt(color.substring(8, 9), 16);
                final int blue = Integer.parseInt(color.substring(16, 17), 16);
                return 0xff000000 | red << 16 | green << 8 | blue;
            }
            return 0x00000000;
        }
        if (color.charAt(0) == '%') {
            throw new ImagingException("HSV colors are not implemented " + "even in the XPM specification!");
        }
        if ("None".equals(color)) {
            return 0x00000000;
        }
        loadColorNames();
        final String colorLowercase = color.toLowerCase(Locale.ROOT);
        return colorNames.getOrDefault(colorLowercase, 0x00000000);
    }
Constructs a new instance with the big-endian byte order.
src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java