Struct Color
Describes a color in terms of alpha, red, green, and blue channels.
Implements
Inherited Members
Namespace: System.Windows.Media
Assembly: OpenSilver.dll
Syntax
public struct Color : IFormattable
Properties
| Improve this Doc View SourceA
Gets or sets the sRGB alpha channel value of the color.
Declaration
public byte A { get; set; }
Property Value
Type | Description |
---|---|
System.Byte | The sRGB alpha channel value of the color, as a value between 0 and 255. |
B
Gets or sets the sRGB red channel value of the color.
Declaration
public byte B { get; set; }
Property Value
Type | Description |
---|---|
System.Byte | The sRGB red channel value, as a value between 0 and 255. |
G
Gets or sets the sRGB green channel value of the color.
Declaration
public byte G { get; set; }
Property Value
Type | Description |
---|---|
System.Byte | The sRGB green channel value, as a value between 0 and 255. |
R
Gets or sets the sRGB blue channel value of the color.
Declaration
public byte R { get; set; }
Property Value
Type | Description |
---|---|
System.Byte | The sRGB blue channel value, as a value between 0 and 255. |
Methods
| Improve this Doc View SourceEquals(Object)
Tests whether the specified object is a Color structure and is equivalent to the current color.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to compare to the current Color structure. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified object is a Color structure and is identical to the current Color structure; otherwise, false. |
Overrides
Equals(Color)
Tests whether the specified Color structure is identical to the current color.
Declaration
public bool Equals(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The Color structure to compare to the current Color structure. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified Color structure is identical to the current Color structure; otherwise, false. |
FromArgb(Byte, Byte, Byte, Byte)
Creates a new Color structure by using the specified sRGB alpha channel and color channel values.
Declaration
public static Color FromArgb(byte a, byte r, byte g, byte b)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | a | The alpha channel, A, of the new color. The value must be between 0 and 255. |
System.Byte | r | The red channel, R, of the new color. The value must be between 0 and 255. |
System.Byte | g | The green channel, G, of the new color. The value must be between 0 and 255. |
System.Byte | b | The blue channel, B, of the new color. The value must be between 0 and 255. |
Returns
Type | Description |
---|---|
Color | A Color structure with the specified values. |
FromRgb(Byte, Byte, Byte)
Color - sRgb legacy interface, assumes Rgb values are sRgb
Declaration
public static Color FromRgb(byte r, byte g, byte b)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | r | |
System.Byte | g | |
System.Byte | b |
Returns
Type | Description |
---|---|
Color |
FromScRgb(Single, Single, Single, Single)
FromScRgb
Declaration
public static Color FromScRgb(float a, float r, float g, float b)
Parameters
Type | Name | Description |
---|---|---|
System.Single | a | |
System.Single | r | |
System.Single | g | |
System.Single | b |
Returns
Type | Description |
---|---|
Color |
GetHashCode()
Gets a hash code for the current Color structure.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the current Color structure. |
Overrides
ToString()
Creates a string representation of the color using the ARGB channels in hex notation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The string representation of the color. |
Overrides
ToString(IFormatProvider)
Creates a string representation of the color by using the ARGB channels and the specified format provider.
Declaration
public string ToString(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | provider | Culture-specific formatting information. |
Returns
Type | Description |
---|---|
System.String | The string representation of the color. |
Operators
| Improve this Doc View SourceEquality(Color, Color)
Tests whether two Color structures are identical.
Declaration
public static bool operator ==(Color color1, Color color2)
Parameters
Type | Name | Description |
---|---|---|
Color | color1 | The first Color structure to compare. |
Color | color2 | The second Color structure to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if color1 and color2 are exactly identical; otherwise, false. |
Explicit(Color to Brush)
Declaration
public static explicit operator Brush(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
Brush |
Inequality(Color, Color)
Tests whether two Color structures are not identical.
Declaration
public static bool operator !=(Color color1, Color color2)
Parameters
Type | Name | Description |
---|---|---|
Color | color1 | The first Color structure to compare. |
Color | color2 | The second Color structure to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if color1 and color2 are not equal; otherwise, false. |
Explicit Interface Implementations
| Improve this Doc View SourceIFormattable.ToString(String, IFormatProvider)
Creates a string representation of this object based on the format string and IFormatProvider passed in. If the provider is null, the CurrentCulture is used. See the documentation for IFormattable for more information.
Declaration
string IFormattable.ToString(string format, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | |
System.IFormatProvider | provider |
Returns
Type | Description |
---|---|
System.String | A string representation of this object. |