# Color

> Representation of RGBA colors.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEquatable\<Color>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IFormattable](https://learn.microsoft.com/dotnet/api/system.iformattable)

```csharp
public struct Color : IEquatable<Color>, IFormattable
```

## Remarks

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.

Components ([Color.r](/engine/6000.0/script-reference/unityengine/color/r.md),[Color.g](/engine/6000.0/script-reference/unityengine/color/g.md),[Color.b](/engine/6000.0/script-reference/unityengine/color/b.md)) define a color in RGB color space. Alpha component ([Color.a](/engine/6000.0/script-reference/unityengine/color/a.md)) defines transparency - alpha of one is completely opaque, alpha of zero is completely transparent.

## Fields

| Value                                                       | Description                                                   |
| ----------------------------------------------------------- | ------------------------------------------------------------- |
| [a](/engine/6000.0/script-reference/unityengine/color/a.md) | Alpha component of the color (0 is transparent, 1 is opaque). |
| [b](/engine/6000.0/script-reference/unityengine/color/b.md) | Blue component of the color.                                  |
| [g](/engine/6000.0/script-reference/unityengine/color/g.md) | Green component of the color.                                 |
| [r](/engine/6000.0/script-reference/unityengine/color/r.md) | Red component of the color.                                   |

## Constructors

| Constructor                                                                                                                                                  | Description                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| [Color(System.Single,System.Single,System.Single)](/engine/6000.0/script-reference/unityengine/color/ctor.md#color\(float-float-float\))                     | Constructs a new Color with given r,g,b components and sets a to 1. |
| [Color(System.Single,System.Single,System.Single,System.Single)](/engine/6000.0/script-reference/unityengine/color/ctor.md#color\(float-float-float-float\)) | Constructs a new Color with given r,g,b,a components.               |

## Properties

| Property                                                                                    | Description                                                                |
| ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [gamma](/engine/6000.0/script-reference/unityengine/color/gamma.md)                         | A version of the color that has had the gamma curve applied.               |
| [grayscale](/engine/6000.0/script-reference/unityengine/color/grayscale.md)                 | The grayscale value of the color. (Read Only)                              |
| [this\[\]](/engine/6000.0/script-reference/unityengine/color/item.md)                       | Access the r, g, b,a components using \[0], \[1], \[2], \[3] respectively. |
| [linear](/engine/6000.0/script-reference/unityengine/color/linear.md)                       | A linear value of an sRGB color.                                           |
| [maxColorComponent](/engine/6000.0/script-reference/unityengine/color/maxcolorcomponent.md) | Returns the maximum color component value: Max(r,g,b).                     |

## Static Properties

| Property                                                                | Description                                                                                                                        |
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| [black](/engine/6000.0/script-reference/unityengine/color/black.md)     | Solid black. RGBA is (0, 0, 0, 1).                                                                                                 |
| [blue](/engine/6000.0/script-reference/unityengine/color/blue.md)       | Solid blue. RGBA is (0, 0, 1, 1).                                                                                                  |
| [clear](/engine/6000.0/script-reference/unityengine/color/clear.md)     | Completely transparent. RGBA is (0, 0, 0, 0).                                                                                      |
| [cyan](/engine/6000.0/script-reference/unityengine/color/cyan.md)       | Cyan. RGBA is (0, 1, 1, 1).                                                                                                        |
| [gray](/engine/6000.0/script-reference/unityengine/color/gray.md)       | Gray. RGBA is (0.5, 0.5, 0.5, 1).                                                                                                  |
| [green](/engine/6000.0/script-reference/unityengine/color/green.md)     | Solid green. RGBA is (0, 1, 0, 1).                                                                                                 |
| [grey](/engine/6000.0/script-reference/unityengine/color/grey.md)       | English spelling for [Color.gray](/engine/6000.0/script-reference/unityengine/color/gray.md). RGBA is the same (0.5, 0.5, 0.5, 1). |
| [magenta](/engine/6000.0/script-reference/unityengine/color/magenta.md) | Magenta. RGBA is (1, 0, 1, 1).                                                                                                     |
| [red](/engine/6000.0/script-reference/unityengine/color/red.md)         | Solid red. RGBA is (1, 0, 0, 1).                                                                                                   |
| [white](/engine/6000.0/script-reference/unityengine/color/white.md)     | Solid white. RGBA is (1, 1, 1, 1).                                                                                                 |
| [yellow](/engine/6000.0/script-reference/unityengine/color/yellow.md)   | Yellow. RGBA is (1, 0.92, 0.016, 1), but the color is nice to look at!                                                             |

## Methods

| Method                                                                    | Description                               |
| ------------------------------------------------------------------------- | ----------------------------------------- |
| [ToString](/engine/6000.0/script-reference/unityengine/color/tostring.md) | Returns a formatted string of this color. |

## Static Methods

| Method                                                                              | Description                                                     |
| ----------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [HSVToRGB](/engine/6000.0/script-reference/unityengine/color/hsvtorgb.md)           | Creates an RGB colour from HSV input.                           |
| [Lerp](/engine/6000.0/script-reference/unityengine/color/lerp.md)                   | Linearly interpolates between colors a and b by t.              |
| [LerpUnclamped](/engine/6000.0/script-reference/unityengine/color/lerpunclamped.md) | Linearly interpolates between colors a and b by t.              |
| [RGBToHSV](/engine/6000.0/script-reference/unityengine/color/rgbtohsv.md)           | Calculates the hue, saturation and value of an RGB input color. |

## Operators

| Operator                                                                          | Description                                                                                                       |
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [operator +](/engine/6000.0/script-reference/unityengine/color/op-addition.md)    | Adds two colors together. Each component is added separately.                                                     |
| [operator /](/engine/6000.0/script-reference/unityengine/color/op-division.md)    | Divides color a by the float b. Each color component is scaled separately.                                        |
| [Vector4](/engine/6000.0/script-reference/unityengine/color/op-implicit.md)       | Colors can be implicitly converted to and from [Vector4](/engine/6000.0/script-reference/unityengine/vector4.md). |
| [Color](/engine/6000.0/script-reference/unityengine/color/op-implicit.md)         | Colors can be implicitly converted to and from [Vector4](/engine/6000.0/script-reference/unityengine/vector4.md). |
| [operator \*](/engine/6000.0/script-reference/unityengine/color/op-multiply.md)   | Multiplies color a by the float b. Each color component is scaled separately.                                     |
| [operator -](/engine/6000.0/script-reference/unityengine/color/op-subtraction.md) | Subtracts color b from color a. Each component is subtracted separately.                                          |
