private static Color parseHexColor(String hexString) {
		String value = hexString.trim();
		if (value.startsWith("#")) {
			value = value.substring(1);
		}
		else if (value.startsWith("0x")) {
			value = value.substring(2);
		}
		else {
			return null;
		}

		if (value.length() != 8 && value.length() != 6) {
			return null;
		}

		boolean hasAlpha = value.length() == 8;
		if (hasAlpha) {
			// alpha value is the last 2 digits, Color wants alpha to be in upper bits so re-arrange
			value = value.substring(6) + value.substring(0, 6);
		}

		try {
			long colorValue = Long.parseLong(value, 16);
			return new Color((int) colorValue, hasAlpha);
		}
		catch (NumberFormatException e) {
			return null;
		}
	}
Parses the given string into a color. The string must be in one of the following formats:
<pre>
#rrggbb
#rrggbbaa
0xrrggbb
0xrrggbbaa
</pre>

Each of the hex digits "rr", "gg", "bb", and "aa" specify the red, green, blue, and alpha
values respectively.
<br><br>

@param hexString the string to parse into a color.
@return the parsed Color or null if the input string was invalid.
Ghidra/Framework/Gui/src/main/java/ghidra/util/WebColors.java