Struct Color

Definition

Namespace:
Tizen.Common
Assembly:
Tizen.dll
API Level:
3

Structure that represents a color as RGBA.

C#
Copy
public struct Color : IEquatable<Color>
Implements
System.IEquatable<Color>

Constructors

View Source

Color(Int32, Int32, Int32)

Initiates the new color with R,G,B components. The Alpha value will be 255 as default.

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

Red (0 ~ 255).

Int32 g

Green (0 ~ 255).

Int32 b

Blue (0 ~ 255).

API Level: 3
View Source

Color(Int32, Int32, Int32, Int32)

Initiates the new color with R,G,B,A components.

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

Red (0 ~ 255).

Int32 g

Green (0 ~ 255).

Int32 b

Blue (0 ~ 255).

Int32 a

Alpha (0 ~ 255).

API Level: 3

Fields

View Source

Aqua

Aqua color instance. Its RGB value is (0, 255, 255).

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

Black

Black color instance. Its RGB value is (0, 0, 0).

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

Blue

Blue color instance. Its RGB value is (0, 0, 255).

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

Empty

Empty color instance. All components are 0.

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

Fuchsia

Fuchsia color instance. Its RGB value is (255, 0, 255).

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

Gray

Gray color instance. Its RGB value is (128, 128, 128).

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

Green

Green color instance. Its RGB value is (0, 128, 0).

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

Lime

Lime color instance. Its RGB value is (0, 255, 0).

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

Maroon

Maroon color instance. Its RGB value is (128, 0, 0).

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

Navy

Navy color instance. Its RGB value is (0, 0, 128).

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

Olive

Olive color instance. Its RGB value is (128, 128, 0).

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

Pink

Pink color instance. Its RGB value is (255, 102, 255).

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

Purple

Purple color instance. Its RGB value is (128, 0, 128).

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

Red

Red color instance. Its RGB value is (255, 0, 0).

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

Silver

Silver color instance. Its RGB value is (192, 192, 192).

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

Teal

Teal color instance. Its RGB value is (0, 128, 128).

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

Transparent

Transparent color instance. All components are 0.

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

White

White color instance. Its RGB value is (255, 255, 255).

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

Yellow

Yellow color instance. Its RGB value is (255, 255, 0).

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

Properties

View Source

A

Gets the Alpha component of the color.

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

B

Gets the Blue component of the color.

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

G

Gets the Green component of the color.

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

R

Gets the Red component of the color.

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

Methods

View Source

Equals(Object)

Returns a boolean indicating whether the given object is equal to this Color instance.

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

The object to compare against.

Returns
Type Description
Boolean

True if the object is equal to this color; False otherwise.

Overrides
API Level: 3
View Source

Equals(Color)

Returns a boolean indicating whether the given color is equal to this Color instance.

Declaration
C#
Copy
public bool Equals(Color other)
Parameters
Type Name Description
Color other

The color to compare this instance to.

Returns
Type Description
Boolean

True if the other color is equal to this instance; False otherwise.

API Level: 3
View Source

FromHex(String)

Returns a new RGB color instance with the requested Red, Green, and Blue channels. The Alpha channel is set if hex contains one.

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

A string that contains the hexadecimal RGB(A) color representation.

Returns
Type Description
Color

The RGBA color instance.

API Level: 3
View Source

FromRgb(Int32, Int32, Int32)

Returns a new RGB color instance.

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

The Red component of the color.

Int32 g

The Green component of the color.

Int32 b

The Blue component of the color.

Returns
Type Description
Color
API Level: 3
View Source

FromRgba(Int32, Int32, Int32, Int32)

Returns a new RGBA color instance.

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

The Red component of the color.

Int32 g

The Green component of the color.

Int32 b

The Blue component of the color.

Int32 a

The Alpha component of the color.

Returns
Type Description
Color

The RGBA color instance.

API Level: 3
View Source

GetArgb()

Gets the 32-bits ARGB value of the color.

Declaration
C#
Copy
public int GetArgb()
Returns
Type Description
Int32
API Level: 3
View Source

GetHashCode()

Returns the hash code for this instance.

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

The hash code.

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

GetRgba()

Gets the 32-bits RGBA value of the color.

Declaration
C#
Copy
public int GetRgba()
Returns
Type Description
Int32
API Level: 3
View Source

ToHex()

Returns a string representation in Hex (For example: #FFFFFFFF in RGBA order).

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

The string representation in Hex.

API Level: 3
View Source

ToString()

Returns a string representation of the color.

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

The string representation.

Overrides
System.ValueType.ToString()
API Level: 3

Operators

View Source

Equality(Color, Color)

Returns a boolean indicating whether the two given colors are equal.

Declaration
C#
Copy
public static bool operator ==(Color color1, Color color2)
Parameters
Type Name Description
Color color1

The first color to compare.

Color color2

The second color to compare.

Returns
Type Description
Boolean

True if the colors are equal; False otherwise.

API Level: 3
View Source

Inequality(Color, Color)

Returns a boolean indicating whether the two given colors are not equal.

Declaration
C#
Copy
public static bool operator !=(Color color1, Color color2)
Parameters
Type Name Description
Color color1

The first color to compare.

Color color2

The second color to compare.

Returns
Type Description
Boolean

True if the colors are not equal; False if they are equal.

API Level: 3

Implements

System.IEquatable<T>