API > Color
Color⚓︎
Representation of RGBA colors.
Members⚓︎
Properties⚓︎
Name | Description |
---|---|
Color .a |
Alpha component of the color (0 is transparent, 1 is opaque). |
Color .b |
Blue component of the color. |
Color .g |
Green component of the color. |
Color .gamma |
A version of the color that has had the gamma curve applied. |
Color .grayscale |
The grayscale value of the color. (Read Only) |
Color .linear |
A linear value of an sRGB color. |
Color .maxColorComponent |
Returns the maximum color component value: Max(r,g,b). |
Color .r |
Red component of the color. |
Static Properties⚓︎
Name | Description |
---|---|
Color .black |
Solid black. RGBA is (0, 0, 0, 1). |
Color .blue |
Solid blue. RGBA is (0, 0, 1, 1). |
Color .clear |
Completely transparent. RGBA is (0, 0, 0, 0). |
Color .cyan |
Cyan. RGBA is (0, 1, 1, 1). |
Color .gray |
Gray. RGBA is (0.5, 0.5, 0.5, 1). |
Color .green |
Solid green. RGBA is (0, 1, 0, 1). |
Color .magenta |
Magenta. RGBA is (1, 0, 1, 1). |
Color .red |
Solid red. RGBA is (1, 0, 0, 1). |
Color .white |
Solid white. RGBA is (1, 1, 1, 1). |
Color .yellow |
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) |
Constructs a new Color with given r,g,b,a components. |
Static Methods⚓︎
Name | Description |
---|---|
Color .HSVToRGB(H, S, V) |
Creates an RGB colour from HSV input. |
Color .HSVToRGB(H, S, V, hdr) |
Creates an RGB color from the hue, saturation and value of the input. |
Color .Lerp(a, b, t) |
Linearly interpolates between colors a and b by t. |
Color .LerpUnclamped(a, b, t ) |
Linearly interpolates between colors a and b by t. |
Color .RGBToHSV(rgbColor) |
Calculates the hue, saturation and value of an RGB input color. |
Operators⚓︎
Name | Description |
---|---|
Operator (Color-Color) | Subtracts color lhs from color rhs . Each component is subtracted separately. |
| Operator (Color*Color) | Multiplies two colors together. Each component is multiplied separately. |
| Operator (Color*number) | Multiplies color lhs
by the number rhs
. Each color component is scaled separately. |
| Operator (number*Color) | Multiplies color rhs
by the number lhs
. Each color component is scaled separately. |
| Operator (Color/number) | Divides color lhs
by the number rhs
. Each color component is scaled separately. |
| Operator (Color+Color) | Adds two colors together. Each component is added separately. |
| Implicit Cast Operator (Vector4) | 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.