Struct Color
Represents an RGBA (red, green, blue, alpha) color for use in the Tank Royale game.
This struct provides methods for creating and manipulating colors.
Assembly: api.dll
Syntax
[PublicAPI]
public readonly struct Color : IEquatable<Color>
Properties
|
Edit this page
View Source
A
Gets the alpha component value of this color.
Declaration
Property Value
Type |
Description |
byte |
The alpha component value between 0 and 255.
|
|
Edit this page
View Source
AliceBlue
Declaration
public static Color AliceBlue { get; }
Property Value
|
Edit this page
View Source
AntiqueWhite
Declaration
public static Color AntiqueWhite { get; }
Property Value
|
Edit this page
View Source
Aqua
Declaration
public static Color Aqua { get; }
Property Value
|
Edit this page
View Source
Aquamarine
Declaration
public static Color Aquamarine { get; }
Property Value
|
Edit this page
View Source
Azure
Declaration
public static Color Azure { get; }
Property Value
|
Edit this page
View Source
B
Gets the blue component value of this color.
Declaration
Property Value
Type |
Description |
byte |
The blue component value between 0 and 255.
|
|
Edit this page
View Source
Beige
Declaration
public static Color Beige { get; }
Property Value
|
Edit this page
View Source
Bisque
Declaration
public static Color Bisque { get; }
Property Value
|
Edit this page
View Source
Black
Declaration
public static Color Black { get; }
Property Value
|
Edit this page
View Source
BlanchedAlmond
Declaration
public static Color BlanchedAlmond { get; }
Property Value
|
Edit this page
View Source
Blue
Declaration
public static Color Blue { get; }
Property Value
|
Edit this page
View Source
BlueViolet
Declaration
public static Color BlueViolet { get; }
Property Value
|
Edit this page
View Source
Brown
Declaration
public static Color Brown { get; }
Property Value
|
Edit this page
View Source
BurlyWood
Declaration
public static Color BurlyWood { get; }
Property Value
|
Edit this page
View Source
CadetBlue
Declaration
public static Color CadetBlue { get; }
Property Value
|
Edit this page
View Source
Chartreuse
Declaration
public static Color Chartreuse { get; }
Property Value
|
Edit this page
View Source
Chocolate
Declaration
public static Color Chocolate { get; }
Property Value
|
Edit this page
View Source
Coral
Declaration
public static Color Coral { get; }
Property Value
|
Edit this page
View Source
CornflowerBlue
Declaration
public static Color CornflowerBlue { get; }
Property Value
|
Edit this page
View Source
Cornsilk
Declaration
public static Color Cornsilk { get; }
Property Value
|
Edit this page
View Source
Crimson
Declaration
public static Color Crimson { get; }
Property Value
|
Edit this page
View Source
Cyan
Declaration
public static Color Cyan { get; }
Property Value
|
Edit this page
View Source
DarkBlue
Declaration
public static Color DarkBlue { get; }
Property Value
|
Edit this page
View Source
DarkCyan
Declaration
public static Color DarkCyan { get; }
Property Value
|
Edit this page
View Source
DarkGoldenrod
Declaration
public static Color DarkGoldenrod { get; }
Property Value
|
Edit this page
View Source
DarkGray
Declaration
public static Color DarkGray { get; }
Property Value
|
Edit this page
View Source
DarkGreen
Declaration
public static Color DarkGreen { get; }
Property Value
|
Edit this page
View Source
DarkKhaki
Declaration
public static Color DarkKhaki { get; }
Property Value
|
Edit this page
View Source
DarkMagenta
Declaration
public static Color DarkMagenta { get; }
Property Value
|
Edit this page
View Source
DarkOliveGreen
Declaration
public static Color DarkOliveGreen { get; }
Property Value
|
Edit this page
View Source
DarkOrange
Declaration
public static Color DarkOrange { get; }
Property Value
|
Edit this page
View Source
DarkOrchid
Declaration
public static Color DarkOrchid { get; }
Property Value
|
Edit this page
View Source
DarkRed
Declaration
public static Color DarkRed { get; }
Property Value
|
Edit this page
View Source
DarkSalmon
Declaration
public static Color DarkSalmon { get; }
Property Value
|
Edit this page
View Source
DarkSeaGreen
Declaration
public static Color DarkSeaGreen { get; }
Property Value
|
Edit this page
View Source
DarkSlateBlue
Declaration
public static Color DarkSlateBlue { get; }
Property Value
|
Edit this page
View Source
DarkSlateGray
Declaration
public static Color DarkSlateGray { get; }
Property Value
|
Edit this page
View Source
DarkTurquoise
Declaration
public static Color DarkTurquoise { get; }
Property Value
|
Edit this page
View Source
DarkViolet
Declaration
public static Color DarkViolet { get; }
Property Value
|
Edit this page
View Source
DeepPink
Declaration
public static Color DeepPink { get; }
Property Value
|
Edit this page
View Source
DeepSkyBlue
Declaration
public static Color DeepSkyBlue { get; }
Property Value
|
Edit this page
View Source
DimGray
Declaration
public static Color DimGray { get; }
Property Value
|
Edit this page
View Source
DodgerBlue
Declaration
public static Color DodgerBlue { get; }
Property Value
|
Edit this page
View Source
Firebrick
Declaration
public static Color Firebrick { get; }
Property Value
|
Edit this page
View Source
FloralWhite
Declaration
public static Color FloralWhite { get; }
Property Value
|
Edit this page
View Source
ForestGreen
Declaration
public static Color ForestGreen { get; }
Property Value
|
Edit this page
View Source
Fuchsia
Declaration
public static Color Fuchsia { get; }
Property Value
|
Edit this page
View Source
G
Gets the green component value of this color.
Declaration
Property Value
Type |
Description |
byte |
The green component value between 0 and 255.
|
|
Edit this page
View Source
Gainsboro
Declaration
public static Color Gainsboro { get; }
Property Value
|
Edit this page
View Source
GhostWhite
Declaration
public static Color GhostWhite { get; }
Property Value
|
Edit this page
View Source
Gold
Declaration
public static Color Gold { get; }
Property Value
|
Edit this page
View Source
Goldenrod
Declaration
public static Color Goldenrod { get; }
Property Value
|
Edit this page
View Source
Gray
Declaration
public static Color Gray { get; }
Property Value
|
Edit this page
View Source
Green
Declaration
public static Color Green { get; }
Property Value
|
Edit this page
View Source
GreenYellow
Declaration
public static Color GreenYellow { get; }
Property Value
|
Edit this page
View Source
Honeydew
Declaration
public static Color Honeydew { get; }
Property Value
|
Edit this page
View Source
HotPink
Declaration
public static Color HotPink { get; }
Property Value
|
Edit this page
View Source
IndianRed
Declaration
public static Color IndianRed { get; }
Property Value
|
Edit this page
View Source
Indigo
Declaration
public static Color Indigo { get; }
Property Value
|
Edit this page
View Source
Ivory
Declaration
public static Color Ivory { get; }
Property Value
|
Edit this page
View Source
Khaki
Declaration
public static Color Khaki { get; }
Property Value
|
Edit this page
View Source
Lavender
Declaration
public static Color Lavender { get; }
Property Value
|
Edit this page
View Source
LavenderBlush
Declaration
public static Color LavenderBlush { get; }
Property Value
|
Edit this page
View Source
LawnGreen
Declaration
public static Color LawnGreen { get; }
Property Value
|
Edit this page
View Source
LemonChiffon
Declaration
public static Color LemonChiffon { get; }
Property Value
|
Edit this page
View Source
LightBlue
Declaration
public static Color LightBlue { get; }
Property Value
|
Edit this page
View Source
LightCoral
Declaration
public static Color LightCoral { get; }
Property Value
|
Edit this page
View Source
LightCyan
Declaration
public static Color LightCyan { get; }
Property Value
|
Edit this page
View Source
LightGoldenrodYellow
Declaration
public static Color LightGoldenrodYellow { get; }
Property Value
|
Edit this page
View Source
LightGray
Declaration
public static Color LightGray { get; }
Property Value
|
Edit this page
View Source
LightGreen
Declaration
public static Color LightGreen { get; }
Property Value
|
Edit this page
View Source
LightPink
Declaration
public static Color LightPink { get; }
Property Value
|
Edit this page
View Source
LightSalmon
Declaration
public static Color LightSalmon { get; }
Property Value
|
Edit this page
View Source
LightSeaGreen
Declaration
public static Color LightSeaGreen { get; }
Property Value
|
Edit this page
View Source
LightSkyBlue
Declaration
public static Color LightSkyBlue { get; }
Property Value
|
Edit this page
View Source
LightSlateGray
Declaration
public static Color LightSlateGray { get; }
Property Value
|
Edit this page
View Source
LightSteelBlue
Declaration
public static Color LightSteelBlue { get; }
Property Value
|
Edit this page
View Source
LightYellow
Declaration
public static Color LightYellow { get; }
Property Value
|
Edit this page
View Source
Lime
Declaration
public static Color Lime { get; }
Property Value
|
Edit this page
View Source
LimeGreen
Declaration
public static Color LimeGreen { get; }
Property Value
|
Edit this page
View Source
Linen
Declaration
public static Color Linen { get; }
Property Value
|
Edit this page
View Source
Magenta
Declaration
public static Color Magenta { get; }
Property Value
|
Edit this page
View Source
Maroon
Declaration
public static Color Maroon { get; }
Property Value
|
Edit this page
View Source
MediumAquamarine
Declaration
public static Color MediumAquamarine { get; }
Property Value
|
Edit this page
View Source
MediumBlue
Declaration
public static Color MediumBlue { get; }
Property Value
|
Edit this page
View Source
MediumOrchid
Declaration
public static Color MediumOrchid { get; }
Property Value
|
Edit this page
View Source
MediumPurple
Declaration
public static Color MediumPurple { get; }
Property Value
|
Edit this page
View Source
MediumSeaGreen
Declaration
public static Color MediumSeaGreen { get; }
Property Value
|
Edit this page
View Source
MediumSlateBlue
Declaration
public static Color MediumSlateBlue { get; }
Property Value
|
Edit this page
View Source
MediumSpringGreen
Declaration
public static Color MediumSpringGreen { get; }
Property Value
|
Edit this page
View Source
MediumTurquoise
Declaration
public static Color MediumTurquoise { get; }
Property Value
|
Edit this page
View Source
MediumVioletRed
Declaration
public static Color MediumVioletRed { get; }
Property Value
|
Edit this page
View Source
MidnightBlue
Declaration
public static Color MidnightBlue { get; }
Property Value
|
Edit this page
View Source
MintCream
Declaration
public static Color MintCream { get; }
Property Value
|
Edit this page
View Source
MistyRose
Declaration
public static Color MistyRose { get; }
Property Value
|
Edit this page
View Source
Moccasin
Declaration
public static Color Moccasin { get; }
Property Value
|
Edit this page
View Source
NavajoWhite
Declaration
public static Color NavajoWhite { get; }
Property Value
|
Edit this page
View Source
Navy
Declaration
public static Color Navy { get; }
Property Value
|
Edit this page
View Source
OldLace
Declaration
public static Color OldLace { get; }
Property Value
|
Edit this page
View Source
Olive
Declaration
public static Color Olive { get; }
Property Value
|
Edit this page
View Source
OliveDrab
Declaration
public static Color OliveDrab { get; }
Property Value
|
Edit this page
View Source
Orange
Declaration
public static Color Orange { get; }
Property Value
|
Edit this page
View Source
OrangeRed
Declaration
public static Color OrangeRed { get; }
Property Value
|
Edit this page
View Source
Orchid
Declaration
public static Color Orchid { get; }
Property Value
|
Edit this page
View Source
PaleGoldenrod
Declaration
public static Color PaleGoldenrod { get; }
Property Value
|
Edit this page
View Source
PaleGreen
Declaration
public static Color PaleGreen { get; }
Property Value
|
Edit this page
View Source
PaleTurquoise
Declaration
public static Color PaleTurquoise { get; }
Property Value
|
Edit this page
View Source
PaleVioletRed
Declaration
public static Color PaleVioletRed { get; }
Property Value
|
Edit this page
View Source
PapayaWhip
Declaration
public static Color PapayaWhip { get; }
Property Value
|
Edit this page
View Source
PeachPuff
Declaration
public static Color PeachPuff { get; }
Property Value
|
Edit this page
View Source
Peru
Declaration
public static Color Peru { get; }
Property Value
|
Edit this page
View Source
Pink
Declaration
public static Color Pink { get; }
Property Value
|
Edit this page
View Source
Plum
Declaration
public static Color Plum { get; }
Property Value
|
Edit this page
View Source
PowderBlue
Declaration
public static Color PowderBlue { get; }
Property Value
|
Edit this page
View Source
Purple
Declaration
public static Color Purple { get; }
Property Value
|
Edit this page
View Source
R
Gets the red component value of this color.
Declaration
Property Value
Type |
Description |
byte |
The red component value between 0 and 255.
|
|
Edit this page
View Source
Red
Declaration
public static Color Red { get; }
Property Value
|
Edit this page
View Source
RosyBrown
Declaration
public static Color RosyBrown { get; }
Property Value
|
Edit this page
View Source
RoyalBlue
Declaration
public static Color RoyalBlue { get; }
Property Value
|
Edit this page
View Source
SaddleBrown
Declaration
public static Color SaddleBrown { get; }
Property Value
|
Edit this page
View Source
Salmon
Declaration
public static Color Salmon { get; }
Property Value
|
Edit this page
View Source
SandyBrown
Declaration
public static Color SandyBrown { get; }
Property Value
|
Edit this page
View Source
SeaGreen
Declaration
public static Color SeaGreen { get; }
Property Value
|
Edit this page
View Source
SeaShell
Declaration
public static Color SeaShell { get; }
Property Value
|
Edit this page
View Source
Sienna
Declaration
public static Color Sienna { get; }
Property Value
|
Edit this page
View Source
Silver
Declaration
public static Color Silver { get; }
Property Value
|
Edit this page
View Source
SkyBlue
Declaration
public static Color SkyBlue { get; }
Property Value
|
Edit this page
View Source
SlateBlue
Declaration
public static Color SlateBlue { get; }
Property Value
|
Edit this page
View Source
SlateGray
Declaration
public static Color SlateGray { get; }
Property Value
|
Edit this page
View Source
Snow
Declaration
public static Color Snow { get; }
Property Value
|
Edit this page
View Source
SpringGreen
Declaration
public static Color SpringGreen { get; }
Property Value
|
Edit this page
View Source
SteelBlue
Declaration
public static Color SteelBlue { get; }
Property Value
|
Edit this page
View Source
Tan
Declaration
public static Color Tan { get; }
Property Value
|
Edit this page
View Source
Teal
Declaration
public static Color Teal { get; }
Property Value
|
Edit this page
View Source
Thistle
Declaration
public static Color Thistle { get; }
Property Value
|
Edit this page
View Source
Tomato
Declaration
public static Color Tomato { get; }
Property Value
|
Edit this page
View Source
Transparent
Declaration
public static Color Transparent { get; }
Property Value
|
Edit this page
View Source
Turquoise
Declaration
public static Color Turquoise { get; }
Property Value
|
Edit this page
View Source
Violet
Declaration
public static Color Violet { get; }
Property Value
|
Edit this page
View Source
Wheat
Declaration
public static Color Wheat { get; }
Property Value
|
Edit this page
View Source
White
Declaration
public static Color White { get; }
Property Value
|
Edit this page
View Source
WhiteSmoke
Declaration
public static Color WhiteSmoke { get; }
Property Value
|
Edit this page
View Source
Yellow
Declaration
public static Color Yellow { get; }
Property Value
|
Edit this page
View Source
YellowGreen
Declaration
public static Color YellowGreen { get; }
Property Value
Methods
|
Edit this page
View Source
Equals(Color)
Determines whether the specified Color is equal to the current Color.
Declaration
public bool Equals(Color other)
Parameters
Type |
Name |
Description |
Color |
other |
The Color to compare with the current Color.
|
Returns
Type |
Description |
bool |
true if the specified Color is equal to the current Color; otherwise, false.
|
|
Edit this page
View Source
Equals(object)
Determines whether the specified object is equal to the current Color.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
object |
obj |
The object to compare with the current Color.
|
Returns
Type |
Description |
bool |
true if the specified object is a Color and equal to the current Color; otherwise, false.
|
Overrides
|
Edit this page
View Source
FromRgb(uint, uint, uint)
Creates a color from the specified red, green, and blue values, with an alpha value of 255 (fully opaque).
Declaration
public static Color FromRgb(uint r, uint g, uint b)
Parameters
Type |
Name |
Description |
uint |
r |
The red component value (0-255).
|
uint |
g |
The green component value (0-255).
|
uint |
b |
The blue component value (0-255).
|
Returns
Type |
Description |
Color |
A new Color structure initialized with the specified RGB values and an alpha value of 255.
|
|
Edit this page
View Source
FromRgba(Color, uint)
Creates a color from the specified base color with a new alpha value.
Declaration
public static Color FromRgba(Color baseColor, uint a)
Parameters
Type |
Name |
Description |
Color |
baseColor |
The Color structure from which to derive the RGB values.
|
uint |
a |
The alpha component value (0-255).
|
Returns
Type |
Description |
Color |
A new Color structure with the RGB values from the base color and the specified alpha value.
|
|
Edit this page
View Source
FromRgba(uint)
Creates a color from a 32-bit RGBA value.
Declaration
public static Color FromRgba(uint rgba)
Parameters
Type |
Name |
Description |
uint |
rgba |
A 32-bit value specifying the RGBA components.
|
Returns
Type |
Description |
Color |
A new Color structure initialized with the specified RGBA value.
|
|
Edit this page
View Source
FromRgba(uint, uint, uint, uint)
Creates a color from the specified red, green, blue, and alpha values.
Declaration
public static Color FromRgba(uint r, uint g, uint b, uint a)
Parameters
Type |
Name |
Description |
uint |
r |
The red component value (0-255).
|
uint |
g |
The green component value (0-255).
|
uint |
b |
The blue component value (0-255).
|
uint |
a |
The alpha component value (0-255).
|
Returns
Type |
Description |
Color |
A new Color structure initialized with the specified RGBA values.
|
|
Edit this page
View Source
GetHashCode()
Returns the hash code for this Color structure.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
int |
An integer hash code for this Color structure.
|
Overrides
|
Edit this page
View Source
ToHexColor()
Converts the color to its hexadecimal representation.
Declaration
public string ToHexColor()
Returns
Type |
Description |
string |
A string representing the color in hexadecimal format:
- If alpha is 255 (fully opaque), returns #RRGGBB
- If alpha is not 255, returns #RRGGBBAA
|
Examples
// For a fully opaque red color
Color red = Color.Red;
string hexRed = red.ToHexColor(); // Returns "#FF0000"
// For a semi-transparent blue color
Color semiTransparentBlue = Color.FromRgba(0, 0, 255, 128);
string hexBlue = semiTransparentBlue.ToHexColor(); // Returns "#0000FF80"
|
Edit this page
View Source
ToRgba()
Converts this Color structure to a 32-bit RGBA value.
Declaration
Returns
Type |
Description |
uint |
A 32-bit integer containing the RGBA representation of this color.
|
|
Edit this page
View Source
ToString()
Converts this Color structure to a human-readable string.
Declaration
public override string ToString()
Returns
Type |
Description |
string |
A string that represents this Color in the format "Color [R=r, G=g, B=b]" when alpha is 255 (fully opaque),
or "Color [A=a, R=r, G=g, B=b]" when alpha is not 255.
|
Overrides
Operators
|
Edit this page
View Source
operator ==(Color, Color)
Determines whether two Color structures are equal.
Declaration
public static bool operator ==(Color left, Color right)
Parameters
Type |
Name |
Description |
Color |
left |
The first Color to compare.
|
Color |
right |
The second Color to compare.
|
Returns
Type |
Description |
bool |
true if the two Colors are equal; otherwise, false.
|
|
Edit this page
View Source
implicit operator uint(Color)
Defines an implicit conversion of a Color structure to a 32-bit integer.
Declaration
public static implicit operator uint(Color color)
Parameters
Type |
Name |
Description |
Color |
color |
The Color structure to convert.
|
Returns
Type |
Description |
uint |
A 32-bit integer containing the RGBA values of the Color structure.
|
|
Edit this page
View Source
implicit operator Color(uint)
Defines an implicit conversion of a 32-bit integer to a Color structure.
Declaration
public static implicit operator Color(uint rgba)
Parameters
Type |
Name |
Description |
uint |
rgba |
A 32-bit integer containing RGBA values.
|
Returns
Type |
Description |
Color |
A Color structure with the specified RGBA values.
|
|
Edit this page
View Source
operator !=(Color, Color)
Determines whether two Color structures are different.
Declaration
public static bool operator !=(Color left, Color right)
Parameters
Type |
Name |
Description |
Color |
left |
The first Color to compare.
|
Color |
right |
The second Color to compare.
|
Returns
Type |
Description |
bool |
true if the two Colors are different; otherwise, false.
|
Implements