Unity Color vs Color32
Unity gives you two everyday color types. They look similar in the inspector and represent the same kind of color; the confusion is mostly about how the channels are stored, and when lighting math 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 colors, 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 colors 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 colors, or packing a color into an int.
new Color32(66, 135, 245, 255)
Same color 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 color 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 color on a material or Image, because 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 color 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 colors, or packing a color into an int.
What does color.linear do?
It converts inspector-style (encoded) numbers into lighting numbers. In a Linear color-space project, use it when you pass a Color into lighting math or a shader yourself. You can usually skip it when you only assign a color to a material or UI Image, because Unity handles that path.
Are Color and Color32 different colors?
No. They store the same on-screen color 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 color in shadersWhat display (sRGB) and linear color 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.
- Color format cheat sheetEvery common color format in one place: hex variants, CSS functions, shader vectors and engine constructors, with the channel ranges and ordering each one expects.