Struct Color
Represents a 32-bit color.
Namespace: Evergine.Common.Graphics
Assembly: Evergine.Common.dll
Syntax
public struct Color
Constructors
Color(byte)
Initializes a new instance of the Color struct.
Declaration
public Color(byte v)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | v | Grayscale tone. |
Color(byte, byte, byte, byte)
Initializes a new instance of the Color struct.
Declaration
public Color(byte r, byte g, byte b, byte a = 255)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | r | The red component. |
| byte | g | The green component. |
| byte | b | The blue component. |
| byte | a | The alpha component. |
Color(float)
Initializes a new instance of the Color struct.
Declaration
public Color(float v)
Parameters
| Type | Name | Description |
|---|---|---|
| float | v | Grayscale tone in the [0, 1] range. |
Color(float, float, float, float)
Initializes a new instance of the Color struct.
Declaration
public Color(float r, float g, float b, float a = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| float | r | Red component in the [0, 1] range. |
| float | g | Green component in the [0, 1] range. |
| float | b | Blue component in the [0, 1] range. |
| float | a | Alpha component in the [0, 1] range. |
Color(string)
Initializes a new instance of the Color struct.
Declaration
public Color(string hex)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hex | Hexadecimal color code. |
Color(uint)
Initializes a new instance of the Color struct.
Declaration
public Color(uint packetValue)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | packetValue | The packet value. |
Fields
A
Represents the alpha component.
Declaration
public byte A
Field Value
| Type | Description |
|---|---|
| byte |
B
Blue component.
Declaration
public byte B
Field Value
| Type | Description |
|---|---|
| byte |
G
Represents the green component.
Declaration
public byte G
Field Value
| Type | Description |
|---|---|
| byte |
R
The red component.
Declaration
public byte R
Field Value
| Type | Description |
|---|---|
| byte |
Properties
AliceBlue
Gets the Alice Blue.
Declaration
public static Color AliceBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
AntiqueWhite
Gets the AntiqueWhite color.
Declaration
public static Color AntiqueWhite { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Aqua
Gets the aqua value.
Declaration
public static Color Aqua { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Aquamarine
Gets the aquamarine color.
Declaration
public static Color Aquamarine { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Azure
Gets Azure.
Declaration
public static Color Azure { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Beige
Gets the beige color.
Declaration
public static Color Beige { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Bisque
Gets the bisque.
Declaration
public static Color Bisque { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Black
Gets the black color.
Declaration
public static Color Black { get; }
Property Value
| Type | Description |
|---|---|
| Color |
BlanchedAlmond
Gets the blanched almond.
Declaration
public static Color BlanchedAlmond { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Blue
Gets the blue color.
Declaration
public static Color Blue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
BlueViolet
Gets the blue-violet color.
Declaration
public static Color BlueViolet { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Brown
Gets the brown color.
Declaration
public static Color Brown { get; }
Property Value
| Type | Description |
|---|---|
| Color |
BurlyWood
Gets the BurlyWood color.
Declaration
public static Color BurlyWood { get; }
Property Value
| Type | Description |
|---|---|
| Color |
CadetBlue
Gets the cadet blue color.
Declaration
public static Color CadetBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Chartreuse
Gets the chartreuse color.
Declaration
public static Color Chartreuse { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Chocolate
Gets the chocolate.
Declaration
public static Color Chocolate { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Coral
Gets the coral.
Declaration
public static Color Coral { get; }
Property Value
| Type | Description |
|---|---|
| Color |
CornflowerBlue
Gets the Cornflower Blue color.
Declaration
public static Color CornflowerBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Cornsilk
Gets the Cornsilk.
Declaration
public static Color Cornsilk { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Crimson
Gets the crimson color.
Declaration
public static Color Crimson { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Cyan
Gets the cyan color.
Declaration
public static Color Cyan { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkBlue
Gets the dark blue color.
Declaration
public static Color DarkBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkCyan
Gets the dark cyan color.
Declaration
public static Color DarkCyan { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkGoldenrod
Gets the dark goldenrod color.
Declaration
public static Color DarkGoldenrod { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkGray
Gets the dark gray color.
Declaration
public static Color DarkGray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkGreen
Gets the dark green color.
Declaration
public static Color DarkGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkKhaki
Gets the color dark khaki.
Declaration
public static Color DarkKhaki { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkMagenta
Gets the dark magenta color.
Declaration
public static Color DarkMagenta { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkOliveGreen
Gets the dark olive green color.
Declaration
public static Color DarkOliveGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkOrange
Gets the dark orange color.
Declaration
public static Color DarkOrange { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkOrchid
Gets the dark orchid color.
Declaration
public static Color DarkOrchid { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkRed
Gets dark red.
Declaration
public static Color DarkRed { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkSalmon
Gets the dark salmon color.
Declaration
public static Color DarkSalmon { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkSeaGreen
Gets the dark sea green color.
Declaration
public static Color DarkSeaGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkSlateBlue
Gets the DarkSlateBlue color.
Declaration
public static Color DarkSlateBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkSlateGray
Gets the dark slate gray color.
Declaration
public static Color DarkSlateGray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkTurquoise
Gets the dark turquoise color.
Declaration
public static Color DarkTurquoise { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DarkViolet
Gets the dark violet color.
Declaration
public static Color DarkViolet { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DeepPink
Gets the deep pink color.
Declaration
public static Color DeepPink { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DeepSkyBlue
Gets the deep sky blue color.
Declaration
public static Color DeepSkyBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DimGray
Gets Dim Gray.
Declaration
public static Color DimGray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
DodgerBlue
Gets the Dodger Blue.
Declaration
public static Color DodgerBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Firebrick
Gets the firebrick color.
Declaration
public static Color Firebrick { get; }
Property Value
| Type | Description |
|---|---|
| Color |
FloralWhite
Gets the Floral White color.
Declaration
public static Color FloralWhite { get; }
Property Value
| Type | Description |
|---|---|
| Color |
ForestGreen
Gets the color forest green.
Declaration
public static Color ForestGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Fuchsia
Gets the fuchsia.
Declaration
public static Color Fuchsia { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Gainsboro
Gets the Gainsboro.
Declaration
public static Color Gainsboro { get; }
Property Value
| Type | Description |
|---|---|
| Color |
GhostWhite
Gets the color Ghost White.
Declaration
public static Color GhostWhite { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Gold
Gets the gold.
Declaration
public static Color Gold { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Goldenrod
Gets the goldenrod.
Declaration
public static Color Goldenrod { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Gray
Gets the gray color.
Declaration
public static Color Gray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Green
Gets the green color.
Declaration
public static Color Green { get; }
Property Value
| Type | Description |
|---|---|
| Color |
GreenYellow
Gets the green-yellow.
Declaration
public static Color GreenYellow { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Honeydew
Gets the honeydew.
Declaration
public static Color Honeydew { get; }
Property Value
| Type | Description |
|---|---|
| Color |
HotPink
Gets the hot pink color.
Declaration
public static Color HotPink { get; }
Property Value
| Type | Description |
|---|---|
| Color |
IndianRed
Gets the Indian Red.
Declaration
public static Color IndianRed { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Indigo
Gets the Indigo.
Declaration
public static Color Indigo { get; }
Property Value
| Type | Description |
|---|---|
| Color |
InherentColor
Gets the inherent color while discarding its luminance.
Declaration
public Color InherentColor { get; }
Property Value
| Type | Description |
|---|---|
| Color |
this[int]
Gets or sets the byte at the specified index.
Declaration
public byte this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The element index. |
Property Value
| Type | Description |
|---|---|
| byte | The byte value at the specified index. |
Ivory
Gets the ivory.
Declaration
public static Color Ivory { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Khaki
Gets the khaki color.
Declaration
public static Color Khaki { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Lavender
Gets the lavender.
Declaration
public static Color Lavender { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LavenderBlush
Gets the lavender blush color.
Declaration
public static Color LavenderBlush { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LawnGreen
Gets the green lawn.
Declaration
public static Color LawnGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LemonChiffon
Gets the lemon chiffon color.
Declaration
public static Color LemonChiffon { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightBlue
Gets the light blue color.
Declaration
public static Color LightBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightCoral
Gets the light coral color.
Declaration
public static Color LightCoral { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightCyan
Gets the light cyan color.
Declaration
public static Color LightCyan { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightGoldenrodYellow
Gets the light goldenrod yellow color.
Declaration
public static Color LightGoldenrodYellow { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightGray
Gets the light gray color.
Declaration
public static Color LightGray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightGreen
Gets the light green color.
Declaration
public static Color LightGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightPink
Gets the light pink color.
Declaration
public static Color LightPink { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightSalmon
Gets the light salmon color.
Declaration
public static Color LightSalmon { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightSeaGreen
Gets the light seagreen color.
Declaration
public static Color LightSeaGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightSkyBlue
Gets the light sky blue color.
Declaration
public static Color LightSkyBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightSlateGray
Gets the light slate gray color.
Declaration
public static Color LightSlateGray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightSteelBlue
Gets the light steel blue color.
Declaration
public static Color LightSteelBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LightYellow
Gets the light yellow color.
Declaration
public static Color LightYellow { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Lime
Gets the lime.
Declaration
public static Color Lime { get; }
Property Value
| Type | Description |
|---|---|
| Color |
LimeGreen
Gets the color lime green.
Declaration
public static Color LimeGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Linen
Gets the linen.
Declaration
public static Color Linen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Luminance
Gets the luminance of the color.
Declaration
public float Luminance { get; }
Property Value
| Type | Description |
|---|---|
| float |
Magenta
Gets the magenta color.
Declaration
public static Color Magenta { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Maroon
Gets the Maroon color.
Declaration
public static Color Maroon { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumAquamarine
Gets the medium aquamarine color.
Declaration
public static Color MediumAquamarine { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumBlue
Gets the medium blue color.
Declaration
public static Color MediumBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumOrchid
Gets the Medium Orchid color.
Declaration
public static Color MediumOrchid { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumPurple
Gets the medium purple color.
Declaration
public static Color MediumPurple { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumSeaGreen
Gets the Medium Sea Green color.
Declaration
public static Color MediumSeaGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumSlateBlue
Gets the medium slate blue color.
Declaration
public static Color MediumSlateBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumSpringGreen
Gets the Medium Spring Green.
Declaration
public static Color MediumSpringGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumTurquoise
Gets the medium turquoise color.
Declaration
public static Color MediumTurquoise { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MediumVioletRed
Gets the medium violet red color.
Declaration
public static Color MediumVioletRed { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MidnightBlue
Gets Midnight Blue.
Declaration
public static Color MidnightBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MintCream
Gets the mint cream.
Declaration
public static Color MintCream { get; }
Property Value
| Type | Description |
|---|---|
| Color |
MistyRose
Gets the Misty Rose color.
Declaration
public static Color MistyRose { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Moccasin
Gets the moccasin.
Declaration
public static Color Moccasin { get; }
Property Value
| Type | Description |
|---|---|
| Color |
NavajoWhite
Gets the Navajo White color.
Declaration
public static Color NavajoWhite { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Navy
Gets the navy.
Declaration
public static Color Navy { get; }
Property Value
| Type | Description |
|---|---|
| Color |
OldLace
Gets the Old Lace.
Declaration
public static Color OldLace { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Olive
Gets the olive.
Declaration
public static Color Olive { get; }
Property Value
| Type | Description |
|---|---|
| Color |
OliveDrab
Gets the olive drab color.
Declaration
public static Color OliveDrab { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Orange
Gets the orange.
Declaration
public static Color Orange { get; }
Property Value
| Type | Description |
|---|---|
| Color |
OrangeRed
Gets the orange-red.
Declaration
public static Color OrangeRed { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Orchid
Gets the orchid.
Declaration
public static Color Orchid { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PaleGoldenrod
Gets the pale goldenrod color.
Declaration
public static Color PaleGoldenrod { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PaleGreen
Gets the pale green color.
Declaration
public static Color PaleGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PaleTurquoise
Gets the pale turquoise color.
Declaration
public static Color PaleTurquoise { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PaleVioletRed
Gets the Pale Violet Red color.
Declaration
public static Color PaleVioletRed { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PapayaWhip
Gets the papaya whip color.
Declaration
public static Color PapayaWhip { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PeachPuff
Gets the Peach Puff color.
Declaration
public static Color PeachPuff { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Peru
Gets the Peru.
Declaration
public static Color Peru { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Pink
Gets the pink color.
Declaration
public static Color Pink { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Plum
Gets the plum.
Declaration
public static Color Plum { get; }
Property Value
| Type | Description |
|---|---|
| Color |
PowderBlue
Gets the color powder blue.
Declaration
public static Color PowderBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Purple
Gets the purple color.
Declaration
public static Color Purple { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Red
Gets the red value.
Declaration
public static Color Red { get; }
Property Value
| Type | Description |
|---|---|
| Color |
RosyBrown
Gets the Rosy Brown color.
Declaration
public static Color RosyBrown { get; }
Property Value
| Type | Description |
|---|---|
| Color |
RoyalBlue
Gets the color royal blue.
Declaration
public static Color RoyalBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SaddleBrown
Gets the color SaddleBrown.
Declaration
public static Color SaddleBrown { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Salmon
Gets the salmon.
Declaration
public static Color Salmon { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SandyBrown
Gets the sandybrown color.
Declaration
public static Color SandyBrown { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SeaGreen
Gets the sea green color.
Declaration
public static Color SeaGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SeaShell
Gets the seashell.
Declaration
public static Color SeaShell { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Sienna
Gets the sienna color.
Declaration
public static Color Sienna { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Silver
Gets the silver.
Declaration
public static Color Silver { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SkyBlue
Gets the sky blue color.
Declaration
public static Color SkyBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SlateBlue
Gets the slate blue color.
Declaration
public static Color SlateBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SlateGray
Gets the slate gray color.
Declaration
public static Color SlateGray { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Snow
Gets the snow information.
Declaration
public static Color Snow { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SpringGreen
Gets the spring green color.
Declaration
public static Color SpringGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
SteelBlue
Gets the steel blue color.
Declaration
public static Color SteelBlue { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Tan
Gets the tangent value.
Declaration
public static Color Tan { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Teal
Gets the teal color.
Declaration
public static Color Teal { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Thistle
Gets the thistle.
Declaration
public static Color Thistle { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Tomato
Gets the tomato.
Declaration
public static Color Tomato { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Transparent
Gets the transparency.
Declaration
public static Color Transparent { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Turquoise
Gets the turquoise color.
Declaration
public static Color Turquoise { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Violet
Gets the violet color.
Declaration
public static Color Violet { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Wheat
Gets the wheat.
Declaration
public static Color Wheat { get; }
Property Value
| Type | Description |
|---|---|
| Color |
White
Gets the color white.
Declaration
public static Color White { get; }
Property Value
| Type | Description |
|---|---|
| Color |
WhiteSmoke
Gets the white smoke color.
Declaration
public static Color WhiteSmoke { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Yellow
Gets the yellow color.
Declaration
public static Color Yellow { get; }
Property Value
| Type | Description |
|---|---|
| Color |
YellowGreen
Gets the yellow-green color.
Declaration
public static Color YellowGreen { get; }
Property Value
| Type | Description |
|---|---|
| Color |
Methods
Equals(Color)
Checks equality with the specified other.
Declaration
public bool Equals(Color other)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | other | The other object. |
Returns
| Type | Description |
|---|---|
| bool | The result. |
Equals(object)
Determines whether the specified object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare to this instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
FromHex(string)
Creates a color from a hex-coded string.
Declaration
public static Color FromHex(string colorcode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | colorcode | Hex format #RRGGBBAA or #RRGGBB. |
Returns
| Type | Description |
|---|---|
| Color | A color instance. |
FromHsl(float, float, float, float)
Creates a color from HSL components.
Declaration
public static Color FromHsl(float h, float s, float l, float a = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| float | h | Hue component in the [0, 1] range. |
| float | s | Saturation component in the [0, 1] range. |
| float | l | Luminance component in the [0, 1] range. |
| float | a | Alpha component in the [0, 1] range. |
Returns
| Type | Description |
|---|---|
| Color | A color in ARGB format. |
FromHsv(float, float, float, float)
Creates a color from HSV components.
Declaration
public static Color FromHsv(float h, float s, float v, float a = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| float | h | Hue component in the [0, 1] range. |
| float | s | Saturation component in the [0, 1] range. |
| float | v | Value component in the [0, 1] range. |
| float | a | Alpha component in the [0, 1] range. |
Returns
| Type | Description |
|---|---|
| Color | An ARGB color. |
FromVector3(ref Vector3)
Converts a Vector3 to a Color.
Declaration
public static Color FromVector3(ref Vector3 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | vector | Vector3 representing the color. |
Returns
| Type | Description |
|---|---|
| Color | The resulting Color. |
FromVector3(ref Vector4, out Color)
Converts Vector4 to Color.
Declaration
public static void FromVector3(ref Vector4 vector, out Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Vector4 with color. |
| Color | color | The color. |
FromVector4(ref Vector4)
Converts a Vector4 to a Color.
Declaration
public static Color FromVector4(ref Vector4 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Vector4 with the color. |
Returns
| Type | Description |
|---|---|
| Color | The Color. |
FromVector4(ref Vector4, out Color)
Converts a Vector4 to a Color.
Declaration
public static void FromVector4(ref Vector4 vector, out Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Vector4 representing the color. |
| Color | color | The resulting color. |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Lerp(Color, Color, float)
Performs linear interpolation between value1 and value2 based on the given amount.
Declaration
public static Color Lerp(Color value1, Color value2, float amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | value1 | The first value. |
| Color | value2 | The second value. |
| float | amount | The interpolation amount, typically between 0 and 1. |
Returns
| Type | Description |
|---|---|
| Color | The interpolated value. |
Lerp(ref Color, ref Color, float)
Linearly interpolates between the specified value1 and value2 by the given amount.
Declaration
public static Color Lerp(ref Color value1, ref Color value2, float amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | value1 | The first value. |
| Color | value2 | The second value. |
| float | amount | The interpolation amount. |
Returns
| Type | Description |
|---|---|
| Color | The interpolated result. |
ToHexColorCode()
Converts to the hexadecimal code.
Declaration
public string ToHexColorCode()
Returns
| Type | Description |
|---|---|
| string | Color as a hexadecimal code with the format #RGBA. |
ToInt()
Converts to an int value.
Declaration
public int ToInt()
Returns
| Type | Description |
|---|---|
| int | Color as an int value. |
ToVector3()
Converts to a Vector3.
Declaration
public Vector3 ToVector3()
Returns
| Type | Description |
|---|---|
| Vector3 | Returns the color as a Vector3. |
ToVector3(ref Vector3)
Converts to a Vector3.
Declaration
public void ToVector3(ref Vector3 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | vector | The color as a Vector3. |
ToVector4()
Converts to a Vector4.
Declaration
public Vector4 ToVector4()
Returns
| Type | Description |
|---|---|
| Vector4 | Returns the color as a Vector4. |
ToVector4(out Vector4)
Converts to a Vector4.
Declaration
public void ToVector4(out Vector4 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Color as a Vector4. |
Operators
operator +(Color, Color)
Implements the + operator.
Declaration
public static Color operator +(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | The first color. |
| Color | b | The second color. |
Returns
| Type | Description |
|---|---|
| Color | The result of the operation. |
operator /(Color, float)
Implements the / operator.
Declaration
public static Color operator /(Color a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | First color. |
| float | b | Second color. |
Returns
| Type | Description |
|---|---|
| Color | The result of the operator. |
operator ==(Color, Color)
Implements the operator ==.
Declaration
public static bool operator ==(Color lhs, Color rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | lhs | The left-hand side operand. |
| Color | rhs | The right-hand side operand. |
Returns
| Type | Description |
|---|---|
| bool | The result of the comparison. |
operator !=(Color, Color)
Implements the != operator.
Declaration
public static bool operator !=(Color lhs, Color rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | lhs | The left-hand side operand. |
| Color | rhs | The right-hand side operand. |
Returns
| Type | Description |
|---|---|
| bool | The result of the operator. |
operator *(Color, Color)
Implements the * operator.
Declaration
public static Color operator *(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | The first color. |
| Color | b | The second color. |
Returns
| Type | Description |
|---|---|
| Color | The result of the operator. |
operator *(Color, float)
Implements the multiplication operator.
Declaration
public static Color operator *(Color a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | The first color. |
| float | b | The second color. |
Returns
| Type | Description |
|---|---|
| Color | The result of the operation. |
operator *(float, Color)
Implements the operator *.
Declaration
public static Color operator *(float b, Color a)
Parameters
| Type | Name | Description |
|---|---|---|
| float | b | Second color. |
| Color | a | First color. |
Returns
| Type | Description |
|---|---|
| Color | The result of the operator. |
operator -(Color, Color)
Implements the subtraction operator.
Declaration
public static Color operator -(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | The first color. |
| Color | b | The second color. |
Returns
| Type | Description |
|---|---|
| Color | The result of the subtraction. |