Color (@NotNull String value) { try { if (value.length() >= 6) { return ColorHexUtil.fromHex(value); } LOG.debug("short color value: ", value); } catch (Exception exception) { LOG.debug("wrong color value: ", value); } if (!StringUtil.isHexDigit(value.charAt(0))) { return null; } int rgb; try { rgb = Integer.parseInt(value, 16); } catch (NumberFormatException ignored) { rgb = Integer.decode(value); } //noinspection UseJBColor return new Color(rgb); }