Struct Color
Definition
- Namespace:
- Tizen.Common
- Assembly:
- Tizen.dll
- API Level:
- 3
Structure that represents a color as RGBA.
public struct Color : IEquatable<Color>
- Implements
Constructors
View SourceColor(Int32, Int32, Int32)
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 |
---|---|---|
Int32 | r | Red (0 ~ 255). |
Int32 | g | Green (0 ~ 255). |
Int32 | b | Blue (0 ~ 255). |
API Level: 3
View SourceColor(Int32, Int32, Int32, Int32)
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 |
---|---|---|
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 SourceAqua
Aqua color instance. Its RGB value is (0, 255, 255).
Declaration
public static readonly Color Aqua
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceBlack
Black color instance. Its RGB value is (0, 0, 0).
Declaration
public static readonly Color Black
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceBlue
Blue color instance. Its RGB value is (0, 0, 255).
Declaration
public static readonly Color Blue
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceEmpty
Empty color instance. All components are 0.
Declaration
public static readonly Color Empty
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceFuchsia
Fuchsia color instance. Its RGB value is (255, 0, 255).
Declaration
public static readonly Color Fuchsia
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceGray
Gray color instance. Its RGB value is (128, 128, 128).
Declaration
public static readonly Color Gray
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceGreen
Green color instance. Its RGB value is (0, 128, 0).
Declaration
public static readonly Color Green
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceLime
Lime color instance. Its RGB value is (0, 255, 0).
Declaration
public static readonly Color Lime
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceMaroon
Maroon color instance. Its RGB value is (128, 0, 0).
Declaration
public static readonly Color Maroon
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceNavy
Navy color instance. Its RGB value is (0, 0, 128).
Declaration
public static readonly Color Navy
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceOlive
Olive color instance. Its RGB value is (128, 128, 0).
Declaration
public static readonly Color Olive
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourcePink
Pink color instance. Its RGB value is (255, 102, 255).
Declaration
public static readonly Color Pink
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourcePurple
Purple color instance. Its RGB value is (128, 0, 128).
Declaration
public static readonly Color Purple
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceRed
Red color instance. Its RGB value is (255, 0, 0).
Declaration
public static readonly Color Red
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceSilver
Silver color instance. Its RGB value is (192, 192, 192).
Declaration
public static readonly Color Silver
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceTeal
Teal color instance. Its RGB value is (0, 128, 128).
Declaration
public static readonly Color Teal
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceTransparent
Transparent color instance. All components are 0.
Declaration
public static readonly Color Transparent
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceWhite
White color instance. Its RGB value is (255, 255, 255).
Declaration
public static readonly Color White
Field Value
Type | Description |
---|---|
Color |
API Level: 3
View SourceYellow
Yellow color instance. Its RGB value is (255, 255, 0).
Declaration
public static readonly Color Yellow
Field Value
Type | Description |
---|---|
Color |
API Level: 3
Properties
View SourceA
Gets the Alpha component of the color.
Declaration
public int A { get; }
Property Value
Type | Description |
---|---|
Int32 |
API Level: 3
View SourceB
Gets the Blue component of the color.
Declaration
public int B { get; }
Property Value
Type | Description |
---|---|
Int32 |
API Level: 3
View SourceG
Gets the Green component of the color.
Declaration
public int G { get; }
Property Value
Type | Description |
---|---|
Int32 |
API Level: 3
View SourceR
Gets the Red component of the color.
Declaration
public int R { get; }
Property Value
Type | Description |
---|---|
Int32 |
API Level: 3
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 |
---|---|
Boolean | True if the object is equal to this color; False otherwise. |
Overrides
API Level: 3
View SourceEquals(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 |
---|---|
Boolean | True if the other color is equal to this instance; False otherwise. |
API Level: 3
View SourceFromHex(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. |
API Level: 3
View SourceFromRgb(Int32, Int32, Int32)
Returns a new RGB color instance.
Declaration
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 SourceFromRgba(Int32, Int32, Int32, Int32)
Returns a new RGBA color instance.
Declaration
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 SourceGetArgb()
Gets the 32-bits ARGB value of the color.
Declaration
public int GetArgb()
Returns
Type | Description |
---|---|
Int32 |
API Level: 3
View SourceGetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code. |
Overrides
API Level: 3
View SourceGetRgba()
Gets the 32-bits RGBA value of the color.
Declaration
public int GetRgba()
Returns
Type | Description |
---|---|
Int32 |
API Level: 3
View SourceToHex()
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. |
API Level: 3
View SourceToString()
Returns a string representation of the color.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The string representation. |
Overrides
API Level: 3
Operators
View SourceEquality(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 |
---|---|
Boolean | True if the colors are equal; False otherwise. |
API Level: 3
View SourceInequality(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 |
---|---|
Boolean | True if the colors are not equal; False if they are equal. |