Hex colors in unity

This is bothering me for quite some time: How can you use hex color values in your script, without the need to convert it first. Is there a simple script or asset everyone is using? I can’t be the only one that finds this representation for a color value strange (at least coming from a web background).

@simpleplaystudio In case anyone else stumbles across this - you can also use hex notation directly e.g.
Color myColor = new Color32( 0x2B, 0xB1, 0xD2, 0xFF ); // RGBA

An extension could be written to fit your needs. I haven’t found it strange to use only numeric RGB values, though I would prefer to have the option available, even if I don’t use them frequently. What we can do, is use the TryParseHexString function:

	Color myColor = new Color();
	Color.TryParseHexString("#F00", out myColor);

You can also create a public color variable and then assign the hex to that variable through the color picker in the inspector. You can do the same with color blocks, if your using UI objects. It’s not ideal, but for the sake of completeness, I thought I should mention it.