Struct Color
Definition
- Assembly:
- Tizen.dll
Structure that represents a color as RGBA.
public struct Color : IEquatable<Color>
- Implements
-
System.IEquatable<T><Color>
Constructors
View SourceColor(int, int, int, int)
Initiates the new color with R,G,B,A components.
Declaration
public Color(int r, int g, int b, int a)
Parameters
Type | Name | Description |
---|---|---|
int | r | Red (0 ~ 255). |
int | g | Green (0 ~ 255). |
int | b | Blue (0 ~ 255). |
int | a | Alpha (0 ~ 255). |
Color(int, int, int)
Initiates the new color with R,G,B components. The Alpha value will be 255 as default.
Declaration
public Color(int r, int g, int b)
Parameters
Type | Name | Description |
---|---|---|
int | r | Red (0 ~ 255). |
int | g | Green (0 ~ 255). |
int | b | Blue (0 ~ 255). |
Fields
View SourceAqua
Aqua color instance. Its RGB value is (0, 255, 255).
Declaration
public static readonly Color Aqua
Field Value
Type | Description |
---|---|
Color |
Black
Black color instance. Its RGB value is (0, 0, 0).
Declaration
public static readonly Color Black
Field Value
Type | Description |
---|---|
Color |
Blue
Blue color instance. Its RGB value is (0, 0, 255).
Declaration
public static readonly Color Blue
Field Value
Type | Description |
---|---|
Color |
Empty
Empty color instance. All components are 0.
Declaration
public static readonly Color Empty
Field Value
Type | Description |
---|---|
Color |
Fuchsia
Fuchsia color instance. Its RGB value is (255, 0, 255).
Declaration
public static readonly Color Fuchsia
Field Value
Type | Description |
---|---|
Color |
Gray
Gray color instance. Its RGB value is (128, 128, 128).
Declaration
public static readonly Color Gray
Field Value
Type | Description |
---|---|
Color |
Green
Green color instance. Its RGB value is (0, 128, 0).
Declaration
public static readonly Color Green
Field Value
Type | Description |
---|---|
Color |
Lime
Lime color instance. Its RGB value is (0, 255, 0).
Declaration
public static readonly Color Lime
Field Value
Type | Description |
---|---|
Color |
Maroon
Maroon color instance. Its RGB value is (128, 0, 0).
Declaration
public static readonly Color Maroon
Field Value
Type | Description |
---|---|
Color |
Navy
Navy color instance. Its RGB value is (0, 0, 128).
Declaration
public static readonly Color Navy
Field Value
Type | Description |
---|---|
Color |
Olive
Olive color instance. Its RGB value is (128, 128, 0).
Declaration
public static readonly Color Olive
Field Value
Type | Description |
---|---|
Color |
Pink
Pink color instance. Its RGB value is (255, 102, 255).
Declaration
public static readonly Color Pink
Field Value
Type | Description |
---|---|
Color |
Purple
Purple color instance. Its RGB value is (128, 0, 128).
Declaration
public static readonly Color Purple
Field Value
Type | Description |
---|---|
Color |
Red
Red color instance. Its RGB value is (255, 0, 0).
Declaration
public static readonly Color Red
Field Value
Type | Description |
---|---|
Color |
Silver
Silver color instance. Its RGB value is (192, 192, 192).
Declaration
public static readonly Color Silver
Field Value
Type | Description |
---|---|
Color |
Teal
Teal color instance. Its RGB value is (0, 128, 128).
Declaration
public static readonly Color Teal
Field Value
Type | Description |
---|---|
Color |
Transparent
Transparent color instance. All components are 0.
Declaration
public static readonly Color Transparent
Field Value
Type | Description |
---|---|
Color |
White
White color instance. Its RGB value is (255, 255, 255).
Declaration
public static readonly Color White
Field Value
Type | Description |
---|---|
Color |
Yellow
Yellow color instance. Its RGB value is (255, 255, 0).
Declaration
public static readonly Color Yellow
Field Value
Type | Description |
---|---|
Color |
Properties
View SourceA
Gets the Alpha component of the color.
Declaration
public int A { get; }
Property Value
Type | Description |
---|---|
int |
B
Gets the Blue component of the color.
Declaration
public int B { get; }
Property Value
Type | Description |
---|---|
int |
G
Gets the Green component of the color.
Declaration
public int G { get; }
Property Value
Type | Description |
---|---|
int |
R
Gets the Red component of the color.
Declaration
public int R { get; }
Property Value
Type | Description |
---|---|
int |
Methods
View SourceEquals(object)
Returns a boolean indicating whether the given object is equal to this Color instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare against. |
Returns
Type | Description |
---|---|
bool | True if the object is equal to this color; False otherwise. |
Overrides
Equals(Color)
Returns a boolean indicating whether the given color is equal to this Color instance.
Declaration
public bool Equals(Color other)
Parameters
Type | Name | Description |
---|---|---|
Color | other | The color to compare this instance to. |
Returns
Type | Description |
---|---|
bool | True if the other color is equal to this instance; False otherwise. |
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
public static Color FromHex(string hex)
Parameters
Type | Name | Description |
---|---|---|
string | hex | A string that contains the hexadecimal RGB(A) color representation. |
Returns
Type | Description |
---|---|
Color | The RGBA color instance. |
FromRgb(int, int, int)
Returns a new RGB color instance.
Declaration
public static Color FromRgb(int r, int g, int b)
Parameters
Type | Name | Description |
---|---|---|
int | r | The Red component of the color. |
int | g | The Green component of the color. |
int | b | The Blue component of the color. |
Returns
Type | Description |
---|---|
Color |
FromRgba(int, int, int, int)
Returns a new RGBA color instance.
Declaration
public static Color FromRgba(int r, int g, int b, int a)
Parameters
Type | Name | Description |
---|---|---|
int | r | The Red component of the color. |
int | g | The Green component of the color. |
int | b | The Blue component of the color. |
int | a | The Alpha component of the color. |
Returns
Type | Description |
---|---|
Color | The RGBA color instance. |
GetArgb()
Gets the 32-bits ARGB value of the color.
Declaration
public int GetArgb()
Returns
Type | Description |
---|---|
int |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code. |
Overrides
GetRgba()
Gets the 32-bits RGBA value of the color.
Declaration
public int GetRgba()
Returns
Type | Description |
---|---|
int |
ToHex()
Returns a string representation in Hex (For example: #FFFFFFFF in RGBA order).
Declaration
public string ToHex()
Returns
Type | Description |
---|---|
string | The string representation in Hex. |
ToString()
Returns a string representation of the color.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The string representation. |
Overrides
Operators
View Sourceoperator ==(Color, Color)
Returns a boolean indicating whether the two given colors are equal.
Declaration
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 |
---|---|
bool | True if the colors are equal; False otherwise. |
operator !=(Color, Color)
Returns a boolean indicating whether the two given colors are not equal.
Declaration
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 |
---|---|
bool | True if the colors are not equal; False if they are equal. |