Unity Color vs Color32
Unity gives you two everyday colour types. They look similar in the inspector and represent the same kind of colour — the confusion is mostly about how the channels are stored, and when lighting maths needs a conversion.
Color vs Color32 at a glance
| Type | Channels | Typical use |
|---|---|---|
Color |
floats 0–1 | Materials, UI, script defaults, inspector fields |
Color32 |
whole numbers 0–255 | Textures, vertex colours, packed ints |
Both match what you see in the Unity inspector. What differs is packaging.
When to use Color
Use Color most of the time. Channels are floats from 0 to 1 (red 0.5 means halfway). Good for materials, UI, script defaults, and colours exposed in the inspector.
new Color(0.26f, 0.53f, 0.96f, 1f)
When to use Color32
Use Color32 when an API wants whole numbers from 0 to 255 instead of 0–1 floats — for example writing into a Texture2D, setting mesh vertex colours, or packing a colour into an int.
new Color32(66, 135, 245, 255)
Same colour as Color, different packaging. Prefer Color in normal scripts; reach for Color32 when the function signature asks for it.
When color.linear matters
If your project uses Linear colour space (Project Settings → Player) and you pass a Color into lighting or a shader yourself, convert first with color.linear. That is Unity’s built-in helper that turns inspector-style numbers into lighting numbers.
Skip this if you are only setting a colour on a material or Image — Unity handles that path for you.
This is the same encoded-versus-linear idea as in shaders. For the full background, see sRGB vs linear colour in shaders.
Get the right numbers
On the picker, the Unity card toggles between Color and Color32 for the same swatch, so you can copy whichever form your API wants without doing the 0–1 ↔ 0–255 conversion by hand.
Questions
Should I use Color or Color32 in Unity scripts?
Use Color for everyday scripting — materials, UI, inspector fields, and defaults. Reach for Color32 when an API wants whole numbers from 0 to 255, such as Texture2D pixels, mesh vertex colours, or packing a colour into an int.
What does color.linear do?
It converts inspector-style (encoded) numbers into lighting numbers. In a Linear colour-space project, use it when you pass a Color into lighting maths or a shader yourself. You can usually skip it when you only assign a colour to a material or UI Image — Unity handles that path.
Are Color and Color32 different colours?
No. They store the same on-screen colour with different packaging: floats from 0–1 versus whole numbers from 0 to 255. Convert with implicit casting or Color32 constructors when an API asks for the other type.
More guides
- sRGB vs linear colour in shadersWhat display (sRGB) and linear colour numbers mean, which to use in shaders and lighting, and how Unity, Unreal and the web treat the same hue.
- OKLCh explained, and why HSL keeps letting you downHow OKLCh works, why its lightness matches what you see when HSL lightness does not, and how to use it to build tonal scales that actually look even.
- Choosing accessible text coloursHow WCAG 2 contrast ratios work, where they go wrong, what APCA does differently, and a practical method for picking text colours that pass and look right.