Color 颜色
Struct
Representation of RGBA colors.
RGBA代表的颜色。
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.
这个结构被用来在整个Unity中传递颜色。每个颜色的组件是一个范围从0到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.
组件 (r,g,b) 在RGB颜色空间内定义一个颜色。 Alpha组件(a) 定义透明度 ― alpha 值是 1 是完全不透明,alpha 值是 0 是完全透明。
Variables变量
- rRed component of the color.
颜色中的红色组件。 - gGreen component of the color.
颜色中的绿色组件。 - bBlue component of the color.
颜色中的蓝色组件。 - aAlpha component of the color.
颜色中的Alpha组件。 - grayscaleThe grayscale value of the color (Read Only)
颜色的灰度值(只读) - this [int index]Access the r, g, b,a components using [0], [1], [2], [3] respectively.
分别用[0],[1],[2],[3]访问r,g,b,a组件。
Constructors构造器
- ColorConstructs a new Color with given r,g,b,a components.
用给定的r,g,b,a组件构造一个新的颜色。
Functions函数
- ToStringReturns a nicely formatted string of this color.
返回该颜色一个格式化好的字符串。
Class Variables类变量
- redSolid red. RGBA is (1, 0, 0, 1).
纯红色。 RGBA 是 (1, 0, 0, 1) 。 - greenSolid green. RGBA is (0, 1, 0, 1).
纯绿色。 RGBA 是 (0, 1, 0, 1)。 - blueSolid blue. RGBA is (0, 0, 1, 1).
纯蓝色。RGBA 是 (0, 1, 0, 1)。 - whiteSolid white. RGBA is (1, 1, 1, 1).
纯白色。 RGBA 是 (1, 1, 1, 1) 。 - blackSolid black. RGBA is (0, 0, 0, 1).
纯黑色。RGBA 是 (0, 0, 0, 1) 。 - yellowYellow. RGBA is weird (1, 235/255, 4/255, 1), but the color is nice to look at!
黄色。 RGBA 是怪异的 (1, 235/255, 4/255, 1) , 但是颜色看起来漂亮! - cyanCyan. RGBA is (0, 1, 1, 1).
青色 。 RGBA 是 (0, 1, 1, 1)。 - magentaMagenta. RGBA is (1, 0, 1, 1).
紫红色。 RGBA 是 (1, 0, 1, 1)。 - grayGray. RGBA is (0.5, 0.5, 0.5, 1).
灰色。 RGBA 是 (0.5, 0.5, 0.5, 1) 。 - greyEnglish spelling for gray. RGBA is the same (0.5, 0.5, 0.5, 1).
英语的另一个写法,grey=gray,灰色。 RGBA 是 (0.5, 0.5, 0.5, 1) 。 - clearCompletely transparent. RGBA is (0, 0, 0, 0).
完全透明。RGBA 是 (0, 0, 0, 0) 。
Class Functions类函数
- operator +Adds two colors together. Each component is added separately.
两个颜色相加,每个组件被分别相加。 - operator -Subtracts color b from color a. Each component is subtracted separately.
颜色a减去颜色b,每个组件分别相减。 - operator *Multiplies two colors together. Each component is multiplied separately.
两个颜色相乘,每个组件分别相乘。 - operator /Divides color a by the float b. Each color component is scaled separately.
颜色a除以浮点数b,每个颜色组件分别相除。 - LerpInterpolates between colors a and b by t.
通过t在颜色a和b之间插值。 - operator Vector4Colors can be implicitly converted to and from Vector4.
颜色能被隐式转换到Vector4,也能由Vector4转回颜色。 - operator ColorColors can be implicitly converted to and from Vector4.
颜色能被隐式转换到Vector4,也能由Vector4转回颜色。