Struct Color

Definition

Namespace:
ElmSharp
Assembly:
ElmSharp.dll
API Level:
preview

The Color is a struct to record the check's state.

C#
Copy
public struct Color

Constructors

View Source

Color(Int32, Int32, Int32)

Creates and initializes a new instance of the Color class with RGB parameters.

Declaration
C#
Copy
public Color(int r, int g, int b)
Parameters
Type Name Description
System.Int32 r

Red of RGB.

System.Int32 g

Green of RGB.

System.Int32 b

Blue of RGB.

API Level: preview
View Source

Color(Int32, Int32, Int32, Int32)

Creates and initializes a new instance of the Color class with RGBA parameters.

Declaration
C#
Copy
public Color(int r, int g, int b, int a)
Parameters
Type Name Description
System.Int32 r

Red of RGBA.

System.Int32 g

Green of RGBA.

System.Int32 b

Blue of RGBA.

System.Int32 a

Alpha of RGBA.

API Level: preview

Fields

View Source

Aqua

The Aqua is a predefined Color instance. It's RGB value is (0, 255, 255).

Declaration
C#
Copy
public static readonly Color Aqua
Field Value
Type Description
Color
API Level: preview
View Source

Black

The Black is a predefined Color instance. It's RGB value is (0, 0, 0).

Declaration
C#
Copy
public static readonly Color Black
Field Value
Type Description
Color
API Level: preview
View Source

Blue

The Blue is a predefined Color instance. It's RGB value is (0, 0, 255).

Declaration
C#
Copy
public static readonly Color Blue
Field Value
Type Description
Color
API Level: preview
View Source

Fuchsia

The Fuchsia is a predefined Color instance. It's RGB value is (255, 0, 255).

Declaration
C#
Copy
public static readonly Color Fuchsia
Field Value
Type Description
Color
API Level: preview
View Source

Gray

The Gray is a predefined Color instance. It's RGB value is (128, 128, 128).

Declaration
C#
Copy
public static readonly Color Gray
Field Value
Type Description
Color
API Level: preview
View Source

Green

The Green is a predefined Color instance. It's RGB value is (0, 128, 0).

Declaration
C#
Copy
public static readonly Color Green
Field Value
Type Description
Color
API Level: preview
View Source

Lime

The Lime is a predefined Color instance. It's RGB value is (0, 255, 0).

Declaration
C#
Copy
public static readonly Color Lime
Field Value
Type Description
Color
API Level: preview
View Source

Maroon

The Maroon is a predefined Color instance. It's RGB value is (128, 0, 0).

Declaration
C#
Copy
public static readonly Color Maroon
Field Value
Type Description
Color
API Level: preview
View Source

Navy

The Navy is a predefined Color instance. It's RGB value is (0, 0, 128).

Declaration
C#
Copy
public static readonly Color Navy
Field Value
Type Description
Color
API Level: preview
View Source

Olive

The Olive is a predefined Color instance. It's RGB value is (128, 128, 0).

Declaration
C#
Copy
public static readonly Color Olive
Field Value
Type Description
Color
API Level: preview
View Source

Orange

The Orange is a predefined Color instance. It's RGB value is (255, 165, 0).

Declaration
C#
Copy
public static readonly Color Orange
Field Value
Type Description
Color
API Level: preview
View Source

Pink

The Pink is a predefined Color instance. It's RGB value is (255, 102, 255).

Declaration
C#
Copy
public static readonly Color Pink
Field Value
Type Description
Color
API Level: preview
View Source

Purple

The Purple is a predefined Color instance. It's RGB value is (128, 0, 128).

Declaration
C#
Copy
public static readonly Color Purple
Field Value
Type Description
Color
API Level: preview
View Source

Red

The Red is a predefined Color instance. It's RGB value is (255, 0, 0).

Declaration
C#
Copy
public static readonly Color Red
Field Value
Type Description
Color
API Level: preview
View Source

Silver

The Silver is a predefined Color instance. It's RGB value is (192, 192, 192).

Declaration
C#
Copy
public static readonly Color Silver
Field Value
Type Description
Color
API Level: preview
View Source

Teal

The Teal is a predefined Color instance. It's RGB value is (0, 128, 128).

Declaration
C#
Copy
public static readonly Color Teal
Field Value
Type Description
Color
API Level: preview
View Source

Transparent

The Tansparent is a predefined Color instance. It's RGBA value is (0, 0, 0, 0).

Declaration
C#
Copy
public static readonly Color Transparent
Field Value
Type Description
Color
API Level: preview
View Source

White

The White is a predefined Color instance. It's RGB value is (255, 255, 255).

Declaration
C#
Copy
public static readonly Color White
Field Value
Type Description
Color
API Level: preview
View Source

Yellow

The Yellow is a predefined Color instance. It's RGB value is (255, 255, 0).

Declaration
C#
Copy
public static readonly Color Yellow
Field Value
Type Description
Color
API Level: preview

Properties

View Source

A

Gets the A value of RGBA. A means the Alpha in color.

Declaration
C#
Copy
public int A { get; }
Property Value
Type Description
System.Int32
API Level: preview
View Source

B

Gets the B value of RGBA. B means the Blue in color.

Declaration
C#
Copy
public int B { get; }
Property Value
Type Description
System.Int32
API Level: preview
View Source

Default

Gets a default Color instance.

Declaration
C#
Copy
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.

API Level: preview
View Source

G

Gets the G value of RGBA. G means the Green in color.

Declaration
C#
Copy
public int G { get; }
Property Value
Type Description
System.Int32
API Level: preview
View Source

IsDefault

Gets whether the Color instance's mode is default or not. The return type is bool.

Declaration
C#
Copy
public bool IsDefault { get; }
Property Value
Type Description
Boolean
API Level: preview
View Source

R

Gets the R value of RGBA. R means the Red in color.

Declaration
C#
Copy
public int R { get; }
Property Value
Type Description
System.Int32
API Level: preview

Methods

View Source

Equals(Object)

Indicates whether this instance and a specified object are equal.

Declaration
C#
Copy
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj

The object to compare with the current instance.

Returns
Type Description
Boolean

true if the object and this instance are of the same type and represent the same value. otherwise, false.

Overrides
API Level: preview
View Source

FromHex(String)

Gets a Color instance with a hexadecimal string parameter.

Declaration
C#
Copy
public static Color FromHex(string hex)
Parameters
Type Name Description
System.String hex

Hexadecimal string.

Returns
Type Description
Color

New instance of the Color struct.

API Level: preview
View Source

FromRgb(Int32, Int32, Int32)

Gets a Color instance with R,G,B parameters.

Declaration
C#
Copy
public static Color FromRgb(int r, int g, int b)
Parameters
Type Name Description
System.Int32 r

Red of RGB.

System.Int32 g

Green of RGB.

System.Int32 b

Blue of RGB.

Returns
Type Description
Color

New instance of the Color struct.

API Level: preview
View Source

FromRgba(Int32, Int32, Int32, Int32)

Gets a Color instance with R,G,B,A parameters.

Declaration
C#
Copy
public static Color FromRgba(int r, int g, int b, int a)
Parameters
Type Name Description
System.Int32 r

Red of RGBA.

System.Int32 g

Green of RGBA.

System.Int32 b

Blue of RGBA.

System.Int32 a

Alpha of RGBA.

Returns
Type Description
Color

New instance of the Color struct.

API Level: preview
View Source

FromUint(UInt32)

Gets a Color instance with an unsigned integer parameter.

Declaration
C#
Copy
public static Color FromUint(uint argb)
Parameters
Type Name Description
System.UInt32 argb

Unsigned integer indicates RGBA.

Returns
Type Description
Color

New instance of the Color struct.

API Level: preview
View Source

GetHashCode()

Returns the hash code for this instance.

Declaration
C#
Copy
public override int GetHashCode()
Returns
Type Description
System.Int32

A 32-bit signed integer hash code.

Overrides
System.ValueType.GetHashCode()
API Level: preview
View Source

ToString()

Returns the fully qualified type name of this instance.

Declaration
C#
Copy
public override string ToString()
Returns
Type Description
System.String

The fully qualified type name.

Overrides
API Level: preview

Operators

View Source

Equality(Color, Color)

Compares whether the two Color instances are same or not.

Declaration
C#
Copy
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
Boolean

The result whether the two instances are the same or not. Return type is bool. If they are same, return true.

API Level: preview
View Source

Inequality(Color, Color)

Compares whether the two Color instances are different or not.

Declaration
C#
Copy
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
Boolean

The result whether the two instances are different or not. Return type is bool. If they are different, return true.

API Level: preview