Struct Color
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Represents a 32-bit color (4 bytes) in the form of RGBA (in byte order: R, G, B, A).
[DataContract("Color")]
[DataStyle(DataStyle.Compact)]
public struct Color : IEquatable<Color>
- Implements
Constructors
Color(Vector3)
Initializes a new instance of the Color struct. Alpha is set to 255.
public Color(Vector3 value)
Parameters
value
Vector3The red, green, and blue components of the color.
Color(Vector3, float)
Initializes a new instance of the Color struct.
public Color(Vector3 value, float alpha)
Parameters
value
Vector3The red, green, and blue components of the color.
alpha
floatThe alpha component of the color.
Color(Vector4)
Initializes a new instance of the Color struct.
public Color(Vector4 value)
Parameters
value
Vector4The red, green, blue, and alpha components of the color.
Color(byte)
Initializes a new instance of the Color struct.
public Color(byte value)
Parameters
value
byteThe value that will be assigned to all components.
Color(byte, byte, byte)
Initializes a new instance of the Color struct. Alpha is set to 255.
public Color(byte red, byte green, byte blue)
Parameters
red
byteThe red component of the color.
green
byteThe green component of the color.
blue
byteThe blue component of the color.
Color(byte, byte, byte, byte)
Initializes a new instance of the Color struct.
public Color(byte red, byte green, byte blue, byte alpha)
Parameters
red
byteThe red component of the color.
green
byteThe green component of the color.
blue
byteThe blue component of the color.
alpha
byteThe alpha component of the color.
Color(byte[])
Initializes a new instance of the Color struct.
public Color(byte[] values)
Parameters
values
byte[]The values to assign to the red, green, blue, or alpha components of the color. This must be an array with four elements.
Exceptions
- ArgumentNullException
Thrown when
values
isnull
.- ArgumentOutOfRangeException
Thrown when
values
contains more or less than four elements.
Color(int)
Initializes a new instance of the Color struct.
public Color(int rgba)
Parameters
rgba
intA packed integer containing all four color components in RGBA order.
Color(float)
Initializes a new instance of the Color struct.
public Color(float value)
Parameters
value
floatThe value that will be assigned to all components.
Color(float, float, float)
Initializes a new instance of the Color struct. Alpha is set to 255.
public Color(float red, float green, float blue)
Parameters
red
floatThe red component of the color.
green
floatThe green component of the color.
blue
floatThe blue component of the color.
Color(float, float, float, float)
Initializes a new instance of the Color struct.
public Color(float red, float green, float blue, float alpha)
Parameters
red
floatThe red component of the color.
green
floatThe green component of the color.
blue
floatThe blue component of the color.
alpha
floatThe alpha component of the color.
Color(float[])
Initializes a new instance of the Color struct.
public Color(float[] values)
Parameters
values
float[]The values to assign to the red, green, and blue, alpha components of the color. This must be an array with four elements.
Exceptions
- ArgumentNullException
Thrown when
values
isnull
.- ArgumentOutOfRangeException
Thrown when
values
contains more or less than four elements.
Color(uint)
Initializes a new instance of the Color struct.
public Color(uint rgba)
Parameters
rgba
uintA packed integer containing all four color components in RGBA order.
Fields
A
The alpha component of the color.
[DataMember(3)]
public byte A
Field Value
AliceBlue
AliceBlue color.
public static readonly Color AliceBlue
Field Value
AntiqueWhite
AntiqueWhite color.
public static readonly Color AntiqueWhite
Field Value
Aqua
Aqua color.
public static readonly Color Aqua
Field Value
Aquamarine
Aquamarine color.
public static readonly Color Aquamarine
Field Value
Azure
Azure color.
public static readonly Color Azure
Field Value
B
The blue component of the color.
[DataMember(2)]
public byte B
Field Value
Beige
Beige color.
public static readonly Color Beige
Field Value
Bisque
Bisque color.
public static readonly Color Bisque
Field Value
Black
Black color.
public static readonly Color Black
Field Value
BlanchedAlmond
BlanchedAlmond color.
public static readonly Color BlanchedAlmond
Field Value
Blue
Blue color.
public static readonly Color Blue
Field Value
BlueViolet
BlueViolet color.
public static readonly Color BlueViolet
Field Value
Brown
Brown color.
public static readonly Color Brown
Field Value
BurlyWood
BurlyWood color.
public static readonly Color BurlyWood
Field Value
CadetBlue
CadetBlue color.
public static readonly Color CadetBlue
Field Value
Chartreuse
Chartreuse color.
public static readonly Color Chartreuse
Field Value
Chocolate
Chocolate color.
public static readonly Color Chocolate
Field Value
Coral
Coral color.
public static readonly Color Coral
Field Value
CornflowerBlue
CornflowerBlue color.
public static readonly Color CornflowerBlue
Field Value
Cornsilk
Cornsilk color.
public static readonly Color Cornsilk
Field Value
Crimson
Crimson color.
public static readonly Color Crimson
Field Value
Cyan
Cyan color.
public static readonly Color Cyan
Field Value
DarkBlue
DarkBlue color.
public static readonly Color DarkBlue
Field Value
DarkCyan
DarkCyan color.
public static readonly Color DarkCyan
Field Value
DarkGoldenrod
DarkGoldenrod color.
public static readonly Color DarkGoldenrod
Field Value
DarkGray
DarkGray color.
public static readonly Color DarkGray
Field Value
DarkGreen
DarkGreen color.
public static readonly Color DarkGreen
Field Value
DarkKhaki
DarkKhaki color.
public static readonly Color DarkKhaki
Field Value
DarkMagenta
DarkMagenta color.
public static readonly Color DarkMagenta
Field Value
DarkOliveGreen
DarkOliveGreen color.
public static readonly Color DarkOliveGreen
Field Value
DarkOrange
DarkOrange color.
public static readonly Color DarkOrange
Field Value
DarkOrchid
DarkOrchid color.
public static readonly Color DarkOrchid
Field Value
DarkRed
DarkRed color.
public static readonly Color DarkRed
Field Value
DarkSalmon
DarkSalmon color.
public static readonly Color DarkSalmon
Field Value
DarkSeaGreen
DarkSeaGreen color.
public static readonly Color DarkSeaGreen
Field Value
DarkSlateBlue
DarkSlateBlue color.
public static readonly Color DarkSlateBlue
Field Value
DarkSlateGray
DarkSlateGray color.
public static readonly Color DarkSlateGray
Field Value
DarkTurquoise
DarkTurquoise color.
public static readonly Color DarkTurquoise
Field Value
DarkViolet
DarkViolet color.
public static readonly Color DarkViolet
Field Value
DeepPink
DeepPink color.
public static readonly Color DeepPink
Field Value
DeepSkyBlue
DeepSkyBlue color.
public static readonly Color DeepSkyBlue
Field Value
DimGray
DimGray color.
public static readonly Color DimGray
Field Value
DodgerBlue
DodgerBlue color.
public static readonly Color DodgerBlue
Field Value
Firebrick
Firebrick color.
public static readonly Color Firebrick
Field Value
FloralWhite
FloralWhite color.
public static readonly Color FloralWhite
Field Value
ForestGreen
ForestGreen color.
public static readonly Color ForestGreen
Field Value
Fuchsia
Fuchsia color.
public static readonly Color Fuchsia
Field Value
G
The green component of the color.
[DataMember(1)]
public byte G
Field Value
Gainsboro
Gainsboro color.
public static readonly Color Gainsboro
Field Value
GhostWhite
GhostWhite color.
public static readonly Color GhostWhite
Field Value
Gold
Gold color.
public static readonly Color Gold
Field Value
Goldenrod
Goldenrod color.
public static readonly Color Goldenrod
Field Value
Gray
Gray color.
public static readonly Color Gray
Field Value
Green
Green color.
public static readonly Color Green
Field Value
GreenYellow
GreenYellow color.
public static readonly Color GreenYellow
Field Value
Honeydew
Honeydew color.
public static readonly Color Honeydew
Field Value
HotPink
HotPink color.
public static readonly Color HotPink
Field Value
IndianRed
IndianRed color.
public static readonly Color IndianRed
Field Value
Indigo
Indigo color.
public static readonly Color Indigo
Field Value
Ivory
Ivory color.
public static readonly Color Ivory
Field Value
Khaki
Khaki color.
public static readonly Color Khaki
Field Value
Lavender
Lavender color.
public static readonly Color Lavender
Field Value
LavenderBlush
LavenderBlush color.
public static readonly Color LavenderBlush
Field Value
LawnGreen
LawnGreen color.
public static readonly Color LawnGreen
Field Value
LemonChiffon
LemonChiffon color.
public static readonly Color LemonChiffon
Field Value
LightBlue
LightBlue color.
public static readonly Color LightBlue
Field Value
LightCoral
LightCoral color.
public static readonly Color LightCoral
Field Value
LightCyan
LightCyan color.
public static readonly Color LightCyan
Field Value
LightGoldenrodYellow
LightGoldenrodYellow color.
public static readonly Color LightGoldenrodYellow
Field Value
LightGray
LightGray color.
public static readonly Color LightGray
Field Value
LightGreen
LightGreen color.
public static readonly Color LightGreen
Field Value
LightPink
LightPink color.
public static readonly Color LightPink
Field Value
LightSalmon
LightSalmon color.
public static readonly Color LightSalmon
Field Value
LightSeaGreen
LightSeaGreen color.
public static readonly Color LightSeaGreen
Field Value
LightSkyBlue
LightSkyBlue color.
public static readonly Color LightSkyBlue
Field Value
LightSlateGray
LightSlateGray color.
public static readonly Color LightSlateGray
Field Value
LightSteelBlue
LightSteelBlue color.
public static readonly Color LightSteelBlue
Field Value
LightYellow
LightYellow color.
public static readonly Color LightYellow
Field Value
Lime
Lime color.
public static readonly Color Lime
Field Value
LimeGreen
LimeGreen color.
public static readonly Color LimeGreen
Field Value
Linen
Linen color.
public static readonly Color Linen
Field Value
Magenta
Magenta color.
public static readonly Color Magenta
Field Value
Maroon
Maroon color.
public static readonly Color Maroon
Field Value
MediumAquamarine
MediumAquamarine color.
public static readonly Color MediumAquamarine
Field Value
MediumBlue
MediumBlue color.
public static readonly Color MediumBlue
Field Value
MediumOrchid
MediumOrchid color.
public static readonly Color MediumOrchid
Field Value
MediumPurple
MediumPurple color.
public static readonly Color MediumPurple
Field Value
MediumSeaGreen
MediumSeaGreen color.
public static readonly Color MediumSeaGreen
Field Value
MediumSlateBlue
MediumSlateBlue color.
public static readonly Color MediumSlateBlue
Field Value
MediumSpringGreen
MediumSpringGreen color.
public static readonly Color MediumSpringGreen
Field Value
MediumTurquoise
MediumTurquoise color.
public static readonly Color MediumTurquoise
Field Value
MediumVioletRed
MediumVioletRed color.
public static readonly Color MediumVioletRed
Field Value
MidnightBlue
MidnightBlue color.
public static readonly Color MidnightBlue
Field Value
MintCream
MintCream color.
public static readonly Color MintCream
Field Value
MistyRose
MistyRose color.
public static readonly Color MistyRose
Field Value
Moccasin
Moccasin color.
public static readonly Color Moccasin
Field Value
NavajoWhite
NavajoWhite color.
public static readonly Color NavajoWhite
Field Value
Navy
Navy color.
public static readonly Color Navy
Field Value
OldLace
OldLace color.
public static readonly Color OldLace
Field Value
Olive
Olive color.
public static readonly Color Olive
Field Value
OliveDrab
OliveDrab color.
public static readonly Color OliveDrab
Field Value
Orange
Orange color.
public static readonly Color Orange
Field Value
OrangeRed
OrangeRed color.
public static readonly Color OrangeRed
Field Value
Orchid
Orchid color.
public static readonly Color Orchid
Field Value
PaleGoldenrod
PaleGoldenrod color.
public static readonly Color PaleGoldenrod
Field Value
PaleGreen
PaleGreen color.
public static readonly Color PaleGreen
Field Value
PaleTurquoise
PaleTurquoise color.
public static readonly Color PaleTurquoise
Field Value
PaleVioletRed
PaleVioletRed color.
public static readonly Color PaleVioletRed
Field Value
PapayaWhip
PapayaWhip color.
public static readonly Color PapayaWhip
Field Value
PeachPuff
PeachPuff color.
public static readonly Color PeachPuff
Field Value
Peru
Peru color.
public static readonly Color Peru
Field Value
Pink
Pink color.
public static readonly Color Pink
Field Value
Plum
Plum color.
public static readonly Color Plum
Field Value
PowderBlue
PowderBlue color.
public static readonly Color PowderBlue
Field Value
Purple
Purple color.
public static readonly Color Purple
Field Value
R
The red component of the color.
[DataMember(0)]
public byte R
Field Value
Red
Red color.
public static readonly Color Red
Field Value
RosyBrown
RosyBrown color.
public static readonly Color RosyBrown
Field Value
RoyalBlue
RoyalBlue color.
public static readonly Color RoyalBlue
Field Value
SaddleBrown
SaddleBrown color.
public static readonly Color SaddleBrown
Field Value
Salmon
Salmon color.
public static readonly Color Salmon
Field Value
SandyBrown
SandyBrown color.
public static readonly Color SandyBrown
Field Value
SeaGreen
SeaGreen color.
public static readonly Color SeaGreen
Field Value
SeaShell
SeaShell color.
public static readonly Color SeaShell
Field Value
Sienna
Sienna color.
public static readonly Color Sienna
Field Value
Silver
Silver color.
public static readonly Color Silver
Field Value
SkyBlue
SkyBlue color.
public static readonly Color SkyBlue
Field Value
SlateBlue
SlateBlue color.
public static readonly Color SlateBlue
Field Value
SlateGray
SlateGray color.
public static readonly Color SlateGray
Field Value
Snow
Snow color.
public static readonly Color Snow
Field Value
SpringGreen
SpringGreen color.
public static readonly Color SpringGreen
Field Value
SteelBlue
SteelBlue color.
public static readonly Color SteelBlue
Field Value
Tan
Tan color.
public static readonly Color Tan
Field Value
Teal
Teal color.
public static readonly Color Teal
Field Value
Thistle
Thistle color.
public static readonly Color Thistle
Field Value
Tomato
Tomato color.
public static readonly Color Tomato
Field Value
Transparent
Transparent color.
public static readonly Color Transparent
Field Value
Turquoise
Turquoise color.
public static readonly Color Turquoise
Field Value
VeryDimGray
VeryDimGray color.
public static readonly Color VeryDimGray
Field Value
Violet
Violet color.
public static readonly Color Violet
Field Value
Wheat
Wheat color.
public static readonly Color Wheat
Field Value
White
White color.
public static readonly Color White
Field Value
WhiteSmoke
WhiteSmoke color.
public static readonly Color WhiteSmoke
Field Value
Yellow
Yellow color.
public static readonly Color Yellow
Field Value
YellowGreen
YellowGreen color.
public static readonly Color YellowGreen
Field Value
Zero
Zero color.
public static readonly Color Zero
Field Value
Properties
this[int]
Gets or sets the component at the specified index.
public byte this[int index] { get; set; }
Parameters
index
intThe index of the component to access. Use 0 for the red(R) component, 1 for the green(G) component, 2 for the blue(B) component, and 3 for the alpha(A) component.
Property Value
- byte
The value of the red, green, blue, or alpha component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
index
is out of the range [0, 3].
Methods
Add(Color, Color)
Adds two colors.
public static Color Add(Color left, Color right)
Parameters
Returns
- Color
The sum of the two colors.
Add(ref readonly Color, ref readonly Color, out Color)
Adds two colors.
public static void Add(ref readonly Color left, ref readonly Color right, out Color result)
Parameters
left
ColorThe first color to add.
right
ColorThe second color to add.
result
ColorWhen the method completes, completes the sum of the two colors.
AdjustContrast(Color, float)
Adjusts the contrast of a color.
public static Color AdjustContrast(Color value, float contrast)
Parameters
value
ColorThe color whose contrast is to be adjusted.
contrast
floatThe amount by which to adjust the contrast.
Returns
- Color
The adjusted color.
AdjustContrast(ref readonly Color, float, out Color)
Adjusts the contrast of a color.
public static void AdjustContrast(ref readonly Color value, float contrast, out Color result)
Parameters
value
ColorThe color whose contrast is to be adjusted.
contrast
floatThe amount by which to adjust the contrast.
result
ColorWhen the method completes, contains the adjusted color.
AdjustSaturation(Color, float)
Adjusts the saturation of a color.
public static Color AdjustSaturation(Color value, float saturation)
Parameters
value
ColorThe color whose saturation is to be adjusted.
saturation
floatThe amount by which to adjust the saturation.
Returns
- Color
The adjusted color.
AdjustSaturation(ref readonly Color, float, out Color)
Adjusts the saturation of a color.
public static void AdjustSaturation(ref readonly Color value, float saturation, out Color result)
Parameters
value
ColorThe color whose saturation is to be adjusted.
saturation
floatThe amount by which to adjust the saturation.
result
ColorWhen the method completes, contains the adjusted color.
Clamp(Color, Color, Color)
Restricts a value to be within a specified range.
public static Color Clamp(Color value, Color min, Color max)
Parameters
Returns
- Color
The clamped value.
Clamp(ref readonly Color, ref readonly Color, ref readonly Color, out Color)
Restricts a value to be within a specified range.
public static void Clamp(ref readonly Color value, ref readonly Color min, ref readonly Color max, out Color result)
Parameters
value
ColorThe value to clamp.
min
ColorThe minimum value.
max
ColorThe maximum value.
result
ColorWhen the method completes, contains the clamped value.
Equals(Color)
Determines whether the specified Color is equal to this instance.
public bool Equals(Color other)
Parameters
Returns
Equals(object)
Determines whether the specified object is equal to this instance.
public override bool Equals(object value)
Parameters
Returns
FromAbgr(int)
Converts the color from a packed ABGR integer.
public static Color FromAbgr(int color)
Parameters
color
intA packed integer containing all four color components in ABGR order
Returns
- Color
A color.
FromAbgr(uint)
Converts the color from a packed ABGR integer.
public static Color FromAbgr(uint color)
Parameters
color
uintA packed integer containing all four color components in ABGR order
Returns
- Color
A color.
FromBgra(int)
Converts the color from a packed BGRA integer.
public static Color FromBgra(int color)
Parameters
color
intA packed integer containing all four color components in BGRA order
Returns
- Color
A color.
FromBgra(uint)
Converts the color from a packed BGRA integer.
public static Color FromBgra(uint color)
Parameters
color
uintA packed integer containing all four color components in BGRA order
Returns
- Color
A color.
FromRgba(int)
Converts the color from a packed RGBA integer.
public static Color FromRgba(int color)
Parameters
color
intA packed integer containing all four color components in RGBA order
Returns
- Color
A color.
FromRgba(uint)
Converts the color from a packed RGBA integer.
public static Color FromRgba(uint color)
Parameters
color
uintA packed integer containing all four color components in RGBA order
Returns
- Color
A color.
GetBrightness()
Gets the brightness.
public float GetBrightness()
Returns
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
GetHue()
Gets the hue.
public float GetHue()
Returns
GetSaturation()
Gets the saturation.
public float GetSaturation()
Returns
Lerp(Color, Color, float)
Performs a linear interpolation between two colors.
public static Color Lerp(Color start, Color end, float amount)
Parameters
start
ColorStart color.
end
ColorEnd color.
amount
floatValue between 0 and 1 indicating the weight of
end
.
Returns
- Color
The linear interpolation of the two colors.
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Lerp(ref readonly Color, ref readonly Color, float, out Color)
Performs a linear interpolation between two colors.
public static void Lerp(ref readonly Color start, ref readonly Color end, float amount, out Color result)
Parameters
start
ColorStart color.
end
ColorEnd color.
amount
floatValue between 0 and 1 indicating the weight of
end
.result
ColorWhen the method completes, contains the linear interpolation of the two colors.
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Max(Color, Color)
Returns a color containing the largest components of the specified colorss.
public static Color Max(Color left, Color right)
Parameters
Returns
- Color
A color containing the largest components of the source colors.
Max(ref readonly Color, ref readonly Color, out Color)
Returns a color containing the smallest components of the specified colors.
public static void Max(ref readonly Color left, ref readonly Color right, out Color result)
Parameters
left
ColorThe first source color.
right
ColorThe second source color.
result
ColorWhen the method completes, contains an new color composed of the largest components of the source colors.
Min(Color, Color)
Returns a color containing the smallest components of the specified colors.
public static Color Min(Color left, Color right)
Parameters
Returns
- Color
A color containing the smallest components of the source colors.
Min(ref readonly Color, ref readonly Color, out Color)
Returns a color containing the smallest components of the specified colors.
public static void Min(ref readonly Color left, ref readonly Color right, out Color result)
Parameters
left
ColorThe first source color.
right
ColorThe second source color.
result
ColorWhen the method completes, contains an new color composed of the smallest components of the source colors.
Modulate(Color, Color)
Modulates two colors.
public static Color Modulate(Color left, Color right)
Parameters
Returns
- Color
The modulated color.
Modulate(ref readonly Color, ref readonly Color, out Color)
Modulates two colors.
public static void Modulate(ref readonly Color left, ref readonly Color right, out Color result)
Parameters
left
ColorThe first color to modulate.
right
ColorThe second color to modulate.
result
ColorWhen the method completes, contains the modulated color.
Negate(Color)
Negates a color.
public static Color Negate(Color value)
Parameters
value
ColorThe color to negate.
Returns
- Color
The negated color.
Negate(ref readonly Color, out Color)
Negates a color.
public static void Negate(ref readonly Color value, out Color result)
Parameters
value
ColorThe color to negate.
result
ColorWhen the method completes, contains the negated color.
Scale(Color, float)
Scales a color.
public static Color Scale(Color value, float scale)
Parameters
Returns
- Color
The scaled color.
Scale(ref readonly Color, float, out Color)
Scales a color.
public static void Scale(ref readonly Color value, float scale, out Color result)
Parameters
value
ColorThe color to scale.
scale
floatThe amount by which to scale.
result
ColorWhen the method completes, contains the scaled color.
SmoothStep(Color, Color, float)
Performs a cubic interpolation between two colors.
public static Color SmoothStep(Color start, Color end, float amount)
Parameters
start
ColorStart color.
end
ColorEnd color.
amount
floatValue between 0 and 1 indicating the weight of
end
.
Returns
- Color
The cubic interpolation of the two colors.
SmoothStep(ref readonly Color, ref readonly Color, float, out Color)
Performs a cubic interpolation between two colors.
public static void SmoothStep(ref readonly Color start, ref readonly Color end, float amount, out Color result)
Parameters
start
ColorStart color.
end
ColorEnd color.
amount
floatValue between 0 and 1 indicating the weight of
end
.result
ColorWhen the method completes, contains the cubic interpolation of the two colors.
Subtract(Color, Color)
Subtracts two colors.
public static Color Subtract(Color left, Color right)
Parameters
Returns
- Color
The difference of the two colors.
Subtract(ref readonly Color, ref readonly Color, out Color)
Subtracts two colors.
public static void Subtract(ref readonly Color left, ref readonly Color right, out Color result)
Parameters
left
ColorThe first color to subtract.
right
ColorThe second color to subtract.
result
ColorWHen the method completes, contains the difference of the two colors.
ToAbgr()
Converts the color into a packed integer.
public int ToAbgr()
Returns
- int
A packed integer containing all four color components.
ToArgb()
Converts the color into a packed integer.
public int ToArgb()
Returns
- int
A packed integer containing all four color components.
ToArray()
Creates an array containing the elements of the color.
public byte[] ToArray()
Returns
- byte[]
A four-element array containing the components of the color in RGBA order.
ToBgra()
Converts the color into a packed integer.
public int ToBgra()
Returns
- int
A packed integer containing all four color components.
ToColor3()
Converts the color into a three component color.
public Color3 ToColor3()
Returns
- Color3
A three component color containing the red, green, and blue components of the color.
ToColor4()
Convert this instance to a Color4
public Color4 ToColor4()
Returns
- Color4
The result of the conversion.
ToRgba()
Converts the color into a packed integer.
public int ToRgba()
Returns
- int
A packed integer containing all four color components.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
ToVector3()
Converts the color into a three component vector.
public Vector3 ToVector3()
Returns
- Vector3
A three component vector containing the red, green, and blue components of the color.
ToVector4()
Converts the color into a four component vector.
public Vector4 ToVector4()
Returns
- Vector4
A four component vector containing all four color components.
Operators
operator +(Color, Color)
Adds two colors.
public static Color operator +(Color left, Color right)
Parameters
Returns
- Color
The sum of the two colors.
operator ==(Color, Color)
Tests for equality between two objects.
public static bool operator ==(Color left, Color right)
Parameters
Returns
- bool
true
ifleft
has the same value asright
; otherwise,false
.
explicit operator Color3(Color)
public static explicit operator Color3(Color value)
Parameters
value
ColorThe value.
Returns
- Color3
The result of the conversion.
explicit operator Vector3(Color)
public static explicit operator Vector3(Color value)
Parameters
value
ColorThe value.
Returns
- Vector3
The result of the conversion.
explicit operator Vector4(Color)
public static explicit operator Vector4(Color value)
Parameters
value
ColorThe value.
Returns
- Vector4
The result of the conversion.
explicit operator int(Color)
public static explicit operator int(Color value)
Parameters
value
ColorThe value.
Returns
- int
The result of the conversion.
explicit operator Color(Color3)
public static explicit operator Color(Color3 value)
Parameters
value
Color3The value.
Returns
- Color
The result of the conversion.
explicit operator Color(Color4)
public static explicit operator Color(Color4 value)
Parameters
value
Color4The value.
Returns
- Color
The result of the conversion.
explicit operator Color(Vector3)
public static explicit operator Color(Vector3 value)
Parameters
value
Vector3The value.
Returns
- Color
The result of the conversion.
explicit operator Color(Vector4)
public static explicit operator Color(Vector4 value)
Parameters
value
Vector4The value.
Returns
- Color
The result of the conversion.
explicit operator Color(int)
public static explicit operator Color(int value)
Parameters
value
intThe value.
Returns
- Color
The result of the conversion.
implicit operator Color4(Color)
public static implicit operator Color4(Color value)
Parameters
value
ColorThe value.
Returns
- Color4
The result of the conversion.
operator !=(Color, Color)
Tests for inequality between two objects.
public static bool operator !=(Color left, Color right)
Parameters
Returns
- bool
true
ifleft
has a different value thanright
; otherwise,false
.
operator *(Color, Color)
Modulates two colors.
public static Color operator *(Color left, Color right)
Parameters
Returns
- Color
The modulated color.
operator *(Color, float)
Scales a color.
public static Color operator *(Color value, float scale)
Parameters
Returns
- Color
The scaled color.
operator *(float, Color)
Scales a color.
public static Color operator *(float scale, Color value)
Parameters
Returns
- Color
The scaled color.
operator -(Color, Color)
Subtracts two colors.
public static Color operator -(Color left, Color right)
Parameters
Returns
- Color
The difference of the two colors.
operator -(Color)
Negates a color.
public static Color operator -(Color value)
Parameters
value
ColorThe color to negate.
Returns
- Color
A negated color.
operator +(Color)
Assert a color (return it unchanged).
public static Color operator +(Color value)
Parameters
value
ColorThe color to assert (unchanged).
Returns
- Color
The asserted (unchanged) color.