Skip to content

API > Color


Color⚓︎

Representation of RGBA colors.

Members⚓︎

Properties⚓︎

Name Description
Color.aProperty Alpha component of the color (0 is transparent, 1 is opaque).
Color.bProperty Blue component of the color.
Color.gProperty Green component of the color.
Color.gammaProperty A version of the color that has had the gamma curve applied.
Color.grayscalePropertyReadonly Property The grayscale value of the color. (Read Only)
Color.linearProperty A linear value of an sRGB color.
Color.maxColorComponentProperty Returns the maximum color component value: Max(r,g,b).
Color.rProperty Red component of the color.

Static Properties⚓︎

Name Description
Color.black Static fieldPropertyReadonly Property Solid black. RGBA is (0, 0, 0, 1).
Color.blue Static fieldPropertyReadonly Property Solid blue. RGBA is (0, 0, 1, 1).
Color.clear Static fieldPropertyReadonly Property Completely transparent. RGBA is (0, 0, 0, 0).
Color.cyan Static fieldPropertyReadonly Property Cyan. RGBA is (0, 1, 1, 1).
Color.gray Static fieldPropertyReadonly Property Gray. RGBA is (0.5, 0.5, 0.5, 1).
Color.green Static fieldPropertyReadonly Property Solid green. RGBA is (0, 1, 0, 1).
Color.magenta Static fieldPropertyReadonly Property Magenta. RGBA is (1, 0, 1, 1).
Color.red Static fieldPropertyReadonly Property Solid red. RGBA is (1, 0, 0, 1).
Color.white Static fieldPropertyReadonly Property Solid white. RGBA is (1, 1, 1, 1).
Color.yellow Static fieldPropertyReadonly Property Yellow. RGBA is (1, 0.92, 0.016, 1), but the color is nice to look at!

Constructor⚓︎

Name Description
Color(r, g, b, a=1.0)Constructor Constructs a new Color with given r,g,b,a components.

Static Methods⚓︎

Name Description
Color.HSVToRGB(H, S, V) Static fieldMethod Creates an RGB colour from HSV input.
Color.HSVToRGB(H, S, V, hdr) Static fieldMethod Creates an RGB color from the hue, saturation and value of the input.
Color.Lerp(a, b, t) Static fieldMethod Linearly interpolates between colors a and b by t.
Color.LerpUnclamped(a, b, t ) Static fieldMethod Linearly interpolates between colors a and b by t.
Color.RGBToHSV(rgbColor) Static fieldMethod Calculates the hue, saturation and value of an RGB input color.

Operators⚓︎

Name Description
Operator (Color-Color)Operator Subtracts color lhs from color rhs. Each component is subtracted separately.

| Operator (Color*Color)Operator | Multiplies two colors together. Each component is multiplied separately. |

| Operator (Color*number)Operator | Multiplies color lhs by the number rhs. Each color component is scaled separately. |

| Operator (number*Color)Operator | Multiplies color rhs by the number lhs. Each color component is scaled separately. |

| Operator (Color/number)Operator | Divides color lhs by the number rhs. Each color component is scaled separately. |

| Operator (Color+Color)Operator | Adds two colors together. Each component is added separately. |

| Implicit Cast Operator (Vector4)Operator | Colors can be implicitly converted to and from Vector4. |

Extra Detail⚓︎

This structure is used throughout Unity to pass colors around. Each color component is a floating point value with a range from 0 to 1.