hex to Unity Color

Unity’s Color holds encoded values, matching what you see in the inspector. In a linear-space project, use the .linear property when the value reaches a shader.

Hue
Alpha
100%
Unity Color
new Color(0.259f, 0.529f, 0.961f, 1.0f)

Paste a hex value — other formats work too.

Need every format at once? Open in the full picker

Worked examples

Common colours converted from hex to Unity Color, computed with the same engine the picker uses.

ColourhexUnity ColorCopy
Pure red#ff0000new Color(1.0f, 0.0f, 0.0f, 1.0f)
Pure green#00ff00new Color(0.0f, 1.0f, 0.0f, 1.0f)
Pure blue#0000ffnew Color(0.0f, 0.0f, 1.0f, 1.0f)
White#ffffffnew Color(1.0f, 1.0f, 1.0f, 1.0f)
Mid grey#808080new Color(0.502f, 0.502f, 0.502f, 1.0f)
Black#000000new Color(0.0f, 0.0f, 0.0f, 1.0f)
Interface blue#4287f5new Color(0.259f, 0.529f, 0.961f, 1.0f)
Success green#22c55enew Color(0.133f, 0.773f, 0.369f, 1.0f)
Danger red#ef4444new Color(0.937f, 0.267f, 0.267f, 1.0f)
Warning amber#f59e0bnew Color(0.961f, 0.62f, 0.043f, 1.0f)
Editor black#1e1e1enew Color(0.118f, 0.118f, 0.118f, 1.0f)
Warm sand#e9c46anew Color(0.914f, 0.769f, 0.416f, 1.0f)

How the conversion works

Unity’s Color holds encoded values, matching what you see in the inspector. In a linear-space project, use the .linear property when the value reaches a shader.

Both formats are computed from a single canonical representation — CIE XYZ with a D65 white point, held in floating point — rather than by chaining one format into the next. That matters because chained conversions accumulate rounding error, and because it means a colour that cannot be represented in the target format is handled deliberately rather than by accident.

When the source describes a colour outside the target's gamut, chroma is reduced in OKLCh while lightness and hue are held, following the CSS Color 4 gamut mapping algorithm. Clipping each channel independently would be simpler but visibly shifts hue on saturated colours.

Related conversions