Class ColorExtension
Color extension.
Inherited Members
Namespace: Forms9Patch
Assembly: Forms9Patch.dll
Syntax
public static class ColorExtension
Methods
ByteA(Color)
Returns a Xamarin.Forms.Color's alpha (opacity) value in byte form
Declaration
public static byte ByteA(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
Byte |
ByteB(Color)
Returns a Xamarin.Forms.Color's blue value in byte form
Declaration
public static byte ByteB(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
Byte |
ByteG(Color)
Returns a Xamarin.Forms.Color's green value in byte form
Declaration
public static byte ByteG(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
Byte |
ByteR(Color)
Returns a Xamarin.Forms.Color's red value in byte form
Declaration
public static byte ByteR(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
Byte |
IsDefault(Color)
Tests if the color is one of the default values
Declaration
public static bool IsDefault(this Color c)
Parameters
Type | Name | Description |
---|---|---|
Color | c |
Returns
Type | Description |
---|---|
Boolean |
IsDefaultOrTransparent(Color)
Tests if the color is a default or is transparent
Declaration
public static bool IsDefaultOrTransparent(this Color c)
Parameters
Type | Name | Description |
---|---|---|
Color | c |
Returns
Type | Description |
---|---|
Boolean |
RgbaBlend(Color, Color, Double)
Interpolates between two colors
Declaration
public static Color RgbaBlend(this Color c1, Color c2, double percent)
Parameters
Type | Name | Description |
---|---|---|
Color | c1 | |
Color | c2 | |
Double | percent |
Returns
Type | Description |
---|---|
Color |
RgbHybridBlend(Color, Color, Double)
Interpolates between two colors - keeping the Alpha of the first (unless it's transparent ... then its white with alpha 0);
Declaration
public static Color RgbHybridBlend(this Color c, Color c2, double percent)
Parameters
Type | Name | Description |
---|---|---|
Color | c | C. |
Color | c2 | C2. |
Double | percent | Percent. |
Returns
Type | Description |
---|---|
Color | The blend. |
ToColor(String)
Takes a color string, typical of an HTML tag's color attribute, and coverts it to a Xamarin.Forms color.
Declaration
public static Color ToColor(this string s)
Parameters
Type | Name | Description |
---|---|---|
String | s | the color string |
Returns
Type | Description |
---|---|
Color | The color. |
ToHexArgbColorString(Color)
Returns a 4 character hexadecimal string of a color's ARGB value
Declaration
public static string ToHexArgbColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Returns
Type | Description |
---|---|
String | The hex rgb color string. |
ToHexRgbColorString(Color)
Returns a 3 character hexadecimal string of a color's RGB value
Declaration
public static string ToHexRgbColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Returns
Type | Description |
---|---|
String | The hex rgb color string. |
ToHexRrggbbColorString(Color)
Returns a 6 character hexadecimal string of a color's RRGGBB value
Declaration
public static string ToHexRrggbbColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Returns
Type | Description |
---|---|
String | The hex rgb color string. |
ToHextAarrggbbColorString(Color)
Returns a 8 character hexadecimal string of a color's AARRGGBB value
Declaration
public static string ToHextAarrggbbColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Returns
Type | Description |
---|---|
String | The hex rgb color string. |
ToIntRgbaColorString(Color)
Returns a sring with comma separated, 0-255, integer values for color's RGBA
Declaration
public static string ToIntRgbaColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color |
Returns
Type | Description |
---|---|
String |
ToIntRgbColorString(Color)
Returns a string with comma separated, 0-255, integer values for color's RGB
Declaration
public static string ToIntRgbColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Returns
Type | Description |
---|---|
String | The int rgb color string. |
ToRgbaColorString(Color)
Returns a string with comma separated, 0-255, integer values for color's RGBA
Declaration
public static string ToRgbaColorString(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Returns
Type | Description |
---|---|
String | The int rgb color string. |
WithAlpha(Color, Double)
Withs the alpha.
Declaration
public static Color WithAlpha(this Color c, double alpha)
Parameters
Type | Name | Description |
---|---|---|
Color | c | C. |
Double | alpha | Alpha. |
Returns
Type | Description |
---|---|
Color | The alpha. |