Struct Color
Definition
- Namespace:
- ElmSharp
- Assembly:
- ElmSharp.dll
The Color is a struct to record the check's state.
public struct Color
Constructors
View SourceColor(int, int, int, int)
Creates and initializes a new instance of the Color class with RGBA parameters.
Declaration
public Color(int r, int g, int b, int a)
Parameters
Type | Name | Description |
---|---|---|
int | r | Red of RGBA. |
int | g | Green of RGBA. |
int | b | Blue of RGBA. |
int | a | Alpha of RGBA. |
Color(int, int, int)
Creates and initializes a new instance of the Color class with RGB parameters.
Declaration
public Color(int r, int g, int b)
Parameters
Type | Name | Description |
---|---|---|
int | r | Red of RGB. |
int | g | Green of RGB. |
int | b | Blue of RGB. |
Fields
View SourceAqua
The Aqua is a predefined Color instance. It's RGB value is (0, 255, 255).
Declaration
public static readonly Color Aqua
Field Value
Type | Description |
---|---|
Color |
Black
The Black is a predefined Color instance. It's RGB value is (0, 0, 0).
Declaration
public static readonly Color Black
Field Value
Type | Description |
---|---|
Color |
Blue
The Blue is a predefined Color instance. It's RGB value is (0, 0, 255).
Declaration
public static readonly Color Blue
Field Value
Type | Description |
---|---|
Color |
Fuchsia
The Fuchsia is a predefined Color instance. It's RGB value is (255, 0, 255).
Declaration
public static readonly Color Fuchsia
Field Value
Type | Description |
---|---|
Color |
Gray
The Gray is a predefined Color instance. It's RGB value is (128, 128, 128).
Declaration
public static readonly Color Gray
Field Value
Type | Description |
---|---|
Color |
Green
The Green is a predefined Color instance. It's RGB value is (0, 128, 0).
Declaration
public static readonly Color Green
Field Value
Type | Description |
---|---|
Color |
Lime
The Lime is a predefined Color instance. It's RGB value is (0, 255, 0).
Declaration
public static readonly Color Lime
Field Value
Type | Description |
---|---|
Color |
Maroon
The Maroon is a predefined Color instance. It's RGB value is (128, 0, 0).
Declaration
public static readonly Color Maroon
Field Value
Type | Description |
---|---|
Color |
Navy
The Navy is a predefined Color instance. It's RGB value is (0, 0, 128).
Declaration
public static readonly Color Navy
Field Value
Type | Description |
---|---|
Color |
Olive
The Olive is a predefined Color instance. It's RGB value is (128, 128, 0).
Declaration
public static readonly Color Olive
Field Value
Type | Description |
---|---|
Color |
Orange
The Orange is a predefined Color instance. It's RGB value is (255, 165, 0).
Declaration
public static readonly Color Orange
Field Value
Type | Description |
---|---|
Color |
Pink
The Pink is a predefined Color instance. It's RGB value is (255, 102, 255).
Declaration
public static readonly Color Pink
Field Value
Type | Description |
---|---|
Color |
Purple
The Purple is a predefined Color instance. It's RGB value is (128, 0, 128).
Declaration
public static readonly Color Purple
Field Value
Type | Description |
---|---|
Color |
Red
The Red is a predefined Color instance. It's RGB value is (255, 0, 0).
Declaration
public static readonly Color Red
Field Value
Type | Description |
---|---|
Color |
Silver
The Silver is a predefined Color instance. It's RGB value is (192, 192, 192).
Declaration
public static readonly Color Silver
Field Value
Type | Description |
---|---|
Color |
Teal
The Teal is a predefined Color instance. It's RGB value is (0, 128, 128).
Declaration
public static readonly Color Teal
Field Value
Type | Description |
---|---|
Color |
Transparent
The Tansparent is a predefined Color instance. It's RGBA value is (0, 0, 0, 0).
Declaration
public static readonly Color Transparent
Field Value
Type | Description |
---|---|
Color |
White
The White is a predefined Color instance. It's RGB value is (255, 255, 255).
Declaration
public static readonly Color White
Field Value
Type | Description |
---|---|
Color |
Yellow
The Yellow is a predefined Color instance. It's RGB value is (255, 255, 0).
Declaration
public static readonly Color Yellow
Field Value
Type | Description |
---|---|
Color |
Properties
View SourceA
Gets the A value of RGBA. A means the Alpha in color.
Declaration
public int A { get; }
Property Value
Type | Description |
---|---|
int |
B
Gets the B value of RGBA. B means the Blue in color.
Declaration
public int B { get; }
Property Value
Type | Description |
---|---|
int |
Default
Gets a default Color instance.
Declaration
public static Color Default { get; }
Property Value
Type | Description |
---|---|
Color |
Remarks
In the default Color instance, the mode type is default with RGBA all set as -1.
G
Gets the G value of RGBA. G means the Green in color.
Declaration
public int G { get; }
Property Value
Type | Description |
---|---|
int |
IsDefault
Gets whether the Color instance's mode is default or not. The return type is bool.
Declaration
public bool IsDefault { get; }
Property Value
Type | Description |
---|---|
bool |
R
Gets the R value of RGBA. R means the Red in color.
Declaration
public int R { get; }
Property Value
Type | Description |
---|---|
int |
Methods
View SourceEquals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
bool | true if the object and this instance are of the same type and represent the same value. otherwise, false. |
Overrides
FromHex(string)
Gets a Color instance with a hexadecimal string parameter.
Declaration
public static Color FromHex(string hex)
Parameters
Type | Name | Description |
---|---|---|
string | hex | Hexadecimal string. |
Returns
Type | Description |
---|---|
Color | New instance of the Color struct. |
FromRgb(int, int, int)
Gets a Color instance with R,G,B parameters.
Declaration
public static Color FromRgb(int r, int g, int b)
Parameters
Type | Name | Description |
---|---|---|
int | r | Red of RGB. |
int | g | Green of RGB. |
int | b | Blue of RGB. |
Returns
Type | Description |
---|---|
Color | New instance of the Color struct. |
FromRgba(int, int, int, int)
Gets a Color instance with R,G,B,A parameters.
Declaration
public static Color FromRgba(int r, int g, int b, int a)
Parameters
Type | Name | Description |
---|---|---|
int | r | Red of RGBA. |
int | g | Green of RGBA. |
int | b | Blue of RGBA. |
int | a | Alpha of RGBA. |
Returns
Type | Description |
---|---|
Color | New instance of the Color struct. |
FromUint(uint)
Gets a Color instance with an unsigned integer parameter.
Declaration
public static Color FromUint(uint argb)
Parameters
Type | Name | Description |
---|---|---|
uint | argb | Unsigned integer indicates RGBA. |
Returns
Type | Description |
---|---|
Color | New instance of the Color struct. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer hash code. |
Overrides
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
Operators
View Sourceoperator ==(Color, Color)
Compares whether the two Color instances are same or not.
Declaration
public static bool operator ==(Color a, Color b)
Parameters
Type | Name | Description |
---|---|---|
Color | a | A Color instance. |
Color | b | A Color instance. |
Returns
Type | Description |
---|---|
bool | The result whether the two instances are the same or not. Return type is bool. If they are same, return true. |
operator !=(Color, Color)
Compares whether the two Color instances are different or not.
Declaration
public static bool operator !=(Color a, Color b)
Parameters
Type | Name | Description |
---|---|---|
Color | a | A Color instance. |
Color | b | A Color instance. |
Returns
Type | Description |
---|---|
bool | The result whether the two instances are different or not. Return type is bool. If they are different, return true. |