Color Struct
Represents a color.
public readonly struct Color : IEquatable<Color>
Public Structure Color
Implements IEquatable(Of Color)
Implements
Constructors
Color(Byte, Byte, Byte)
Initializes a new instance of the Color struct with full opacity.
public Color(byte red, byte green, byte blue)
Public Sub New(red As Byte, green As Byte, blue As Byte)
Parameters
red
- System.Byte
The red component.
green
- System.Byte
The green component.
blue
- System.Byte
The blue component.
Color(Byte, Byte, Byte, Byte)
Initializes a new instance of the Color struct.
public Color(byte red, byte green, byte blue, byte alpha)
Public Sub New(red As Byte, green As Byte, blue As Byte, alpha As Byte)
Parameters
red
- System.Byte
The red component.
green
- System.Byte
The green component.
blue
- System.Byte
The blue component.
alpha
- System.Byte
The alpha component.
Color(Single, Single, Single)
Initializes a new instance of the Color struct with full opacity.
public Color(float red, float green, float blue)
Public Sub New(red As Single, green As Single, blue As Single)
Parameters
red
- System.Single
The normalized red component.
green
- System.Single
The normalized green component.
blue
- System.Single
The normalized blue component.
Color(Single, Single, Single, Single)
Initializes a new instance of the Color struct.
public Color(float red, float green, float blue, float alpha)
Public Sub New(red As Single, green As Single, blue As Single, alpha As Single)
Parameters
red
- System.Single
The normalized red component.
green
- System.Single
The normalized green component.
blue
- System.Single
The normalized blue component.
alpha
- System.Single
The normalized alpha component.
Color(String)
Initializes a new instance of the Color struct.
Parameters
hex
- System.String
The string that represents the color in the format #RRGGBBAA or #RRGGBB where RR is the byte that represents the red component, GG is the byte that represents the green component and BB is the byte that represents the blue component. AA is the byte that represents the alpha component.
Fields
Black
Represents a black color (Hex = 0x000000).
Field Value
Blue
Represents a blue color (Hex = 0x0000FF).
Field Value
Brown
Represents a brown color (Hex = 0xA52A2A).
Field Value
Cyan
Represents a cyan color (Hex = 0x00FFFF).
Field Value
DarkBlue
Represents a dark blue color (Hex = 0x000080).
Field Value
DarkCyan
Represents a dark cyan color (Hex = 0x008080).
Field Value
DarkGray
Represents a dark gray color (Hex = 0x808080).
Field Value
DarkGreen
Represents a dark green color (Hex = 0x008000).
Field Value
DarkMagenta
Represents a dark magenta color (Hex = 0x800080).
Field Value
DarkRed
Represents a dark red color (Hex = 0x800000).
Field Value
DarkYellow
Represents a dark yellow color (Hex = 0x808000).
Field Value
Empty
Represents an empty color (Hex = 0x00000000).
Field Value
Gray
Represents a gray color (Hex = 0x808080).
Field Value
Green
Represents a green color (Hex = 0x00FF00).
Field Value
LightGray
Represents a light gray color (Hex = 0xC0C0C0).
Field Value
Magenta
Represents a magenta color (Hex = 0xFF00FF).
Field Value
Orange
Represents an orange color (Hex = 0xFFA500).
Field Value
Pink
Represents a pink color (Hex = 0xFFC0CB).
Field Value
Purple
Represents a purple color (Hex = 0x800080).
Field Value
Red
Represents a red color (Hex = 0xFF0000).
Field Value
White
Represents a write color (Hex = 0xFFFFFF).
Field Value
Yellow
Represents a yellow color (Hex = 0xFFFF00).
Field Value
Properties
B
Gets the normalized blue component of this Color instance.
Property Value
- System.Single
The normalized blue component of this Color instance.
G
Gets the normalized green component of this Color instance.
Property Value
- System.Single
The normalized green component of this Color instance.
IsEmpty
Gets a value indicating whether this Color instance is empty.
Property Value
- System.Boolean
true if this Color instance is empty; otherwise, false.
R
Gets the normalized red component of this Color instance.
Property Value
- System.Single
The normalized red component of this Color instance.
Methods
Equals(Color)
Parameters
other
- Color
The other color to compare with this color instance.
Returns
Equals(Object)
Determines whether the specified System.Object is equal to this Color instance.
public override readonly bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
obj
- System.Object
The System.Object to compare with this color instance.
Returns
- System.Boolean
Overrides
GetHashCode()
Returns a hash code for this Color instance.
Returns
- System.Int32
An integer value that specifies a hash value for this Color instance.
Overrides
ToString()
Returns a System.String that represents this Color instance.
Returns
- System.String
A System.String that represents this Color instance.
Overrides
Operators
Equality(Color, Color)
Determines whether two specified Colors have the same value.
public static bool operator ==(Color first, Color second)
Public Shared Operator =(first As Color, second As Color) As Boolean
Parameters
first
- Color
The first color to compare.
second
- Color
The second color to compare.
Returns
- System.Boolean
true if two specified Colors have the same value; otherwise, false.
Inequality(Color, Color)
Determines whether two specified Colors have different values.
public static bool operator !=(Color first, Color second)
Public Shared Operator <>(first As Color, second As Color) As Boolean
Parameters
first
- Color
The first color to compare.
second
- Color
The second color to compare.
Returns
- System.Boolean
true if two specified Colors have different values; otherwise, false.