public static Color fromHex(String hex)
	{
		if (!hex.startsWith("#") && !hex.startsWith("0x"))
		{
			hex = "#" + hex;
		}

		if ((hex.length() <= 7 && hex.startsWith("#")) || (hex.length() <= 8 && hex.startsWith("0x")))
		{
			try
			{
				return Color.decode(hex);
			}
			catch (NumberFormatException e)
			{
				return null;
			}
		}

		try
		{
			return new Color(Long.decode(hex).intValue(), true);
		}
		catch (NumberFormatException e)
		{
			return null;
		}
	}
@Test
	public void fromHex()
	{
		assertEquals(Color.BLACK, ColorUtil.fromHex("0x000000"));
		assertEquals(Color.BLACK, ColorUtil.fromHex("#000000"));
		assertEquals(Color.BLACK, ColorUtil.fromHex("000000"));

		assertEquals(Color.BLACK, ColorUtil.fromHex("0x0"));
		assertEquals(Color.BLACK, ColorUtil.fromHex("#0"));

		assertEquals(ColorUtil.colorWithAlpha(Color.BLACK, 0), ColorUtil.fromHex("0x00000000"));
		assertEquals(Color.WHITE, ColorUtil.fromHex("0xFFFFFFFF"));

		INVALID_COLOR_HEXSTRING_LIST.forEach((string) ->
		{
			assertNull(ColorUtil.fromHex(string));
		});
	}