Color Structure
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Represents a four-component color using red, green, blue, and alpha data.
Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in Microsoft.Xna.Framework.dll)
Syntax
'Declaration
Public Structure Color
public struct Color
The Color type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Color(Int32, Int32, Int32) | Initializes a new instance of the Color structure using integer values. | |
Color(Single, Single, Single) | Initializes a new instance of the Color structure using floating point values. | |
Color(Int32, Int32, Int32, Int32) | Initializes a new instance of the Color structure using integer values. | |
Color(Single, Single, Single, Single) | Initializes a new instance of the Color structure using floating point values. |
Top
Properties
Name | Description | |
---|---|---|
A | Gets or sets the alpha component value. | |
B | Gets or sets the blue component value. | |
Black | Gets a system-defined color with the value R:0 G:0 B:0 A:255. | |
G | Gets or sets the green component value | |
PackedValue | Gets the current color as a packed value. | |
R | Gets or sets the red component value. | |
Transparent | Gets a system-defined color with the value R:0 G:0 B:0 A:0. | |
White | Gets a system-defined color with the value R:255 G:255 B:255 A:255. |
Top
Methods
Name | Description | |
---|---|---|
Equals(Object) | Determines whether the specified color object equals this object. (Overrides ValueType.Equals(Object).) | |
Equals(Color) | Determines whether the specified color equals this object. | |
FromNonPremultiplied | Converts a non-premultipled alpha color to a color that contains premultiplied alpha. | |
GetHashCode | Gets the hash code for this object. (Overrides ValueType.GetHashCode().) | |
Lerp | Linearly interpolate a color. | |
Multiply | Multiply each color component by the scale factor. | |
ToString | Gets a string representation of this object. (Overrides ValueType.ToString().) |
Top
Operators
Name | Description | |
---|---|---|
Equality | Determines whether the specified colors are equal. | |
Inequality | Determines whether the specified colors are not equal. | |
Multiply | Multiplies the specified color and a scale factor. |
Top
Extension Methods
Name | Description | |
---|---|---|
ToVector3 | Converts the specified color into a Vector3. (Defined by ColorExtensions.) | |
ToVector4 | Converts the specified color into a Vector4. (Defined by ColorExtensions.) |
Top
Version Information
Silverlight
Supported in: 5
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.