struct in UnityEngine
/
Implemented in:UnityEngine.CoreModule
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseRepresentation of RGBA colors.
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 (r,g,b) define a color in RGB color space. Alpha component (a)
defines transparency - alpha of one is completely opaque, alpha of zero is completely
transparent.
black | Solid black. RGBA is (0, 0, 0, 1). |
blue | Solid blue. RGBA is (0, 0, 1, 1). |
clear | Completely transparent. RGBA is (0, 0, 0, 0). |
cyan | Cyan. RGBA is (0, 1, 1, 1). |
gray | Gray. RGBA is (0.5, 0.5, 0.5, 1). |
green | Solid green. RGBA is (0, 1, 0, 1). |
grey | English spelling for gray. RGBA is the same (0.5, 0.5, 0.5, 1). |
magenta | Magenta. RGBA is (1, 0, 1, 1). |
red | Solid red. RGBA is (1, 0, 0, 1). |
white | Solid white. RGBA is (1, 1, 1, 1). |
yellow | Yellow. RGBA is (1, 0.92, 0.016, 1), but the color is nice to look at! |
a | Alpha component of the color (0 is transparent, 1 is opaque). |
b | Blue component of the color. |
g | Green component of the color. |
gamma | A version of the color that has had the gamma curve applied. |
grayscale | The grayscale value of the color. (Read Only) |
linear | A linear value of an sRGB color. |
maxColorComponent | Returns the maximum color component value: Max(r,g,b). |
r | Red component of the color. |
this[int] | Access the r, g, b,a components using [0], [1], [2], [3] respectively. |
Color | Constructs a new Color with given r,g,b,a components. |
ToString | Returns a formatted string of this color. |
HSVToRGB | Creates an RGB colour from HSV input. |
Lerp | Linearly interpolates between colors a and b by t. |
LerpUnclamped | Linearly interpolates between colors a and b by t. |
RGBToHSV | Calculates the hue, saturation and value of an RGB input color. |
Color | Colors can be implicitly converted to and from Vector4. |
operator - | Subtracts color b from color a. Each component is subtracted separately. |
operator * | Multiplies two colors together. Each component is multiplied separately. |
operator / | Divides color a by the float b. Each color component is scaled separately. |
operator + | Adds two colors together. Each component is added separately. |
Vector4 | Colors can be implicitly converted to and from Vector4. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.