Class ColorExtensions
Drawing-related extensions for
Inheritance
Namespace: X10D.Drawing
Assembly: X10D.dll
Syntax
public static class ColorExtensions : object
Methods
| Improve this Doc View SourceDeconstruct(Color, out Byte, out Byte, out Byte)
Deconstructs the current color into its RGB components.
Declaration
public static void Deconstruct(this Color color, out byte r, out byte g, out byte b)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The source color. |
System.Byte | r | When this method returns, contains the |
System.Byte | g | When this method returns, contains the |
System.Byte | b | When this method returns, contains the |
Deconstruct(Color, out Byte, out Byte, out Byte, out Byte)
Deconstructs the current color into its ARGB components.
Declaration
public static void Deconstruct(this Color color, out byte a, out byte r, out byte g, out byte b)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The source color. |
System.Byte | a | When this method returns, contains the |
System.Byte | r | When this method returns, contains the |
System.Byte | g | When this method returns, contains the |
System.Byte | b | When this method returns, contains the |
GetClosestConsoleColor(Color)
Returns a
Declaration
public static ConsoleColor GetClosestConsoleColor(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The source color. |
Returns
Type | Description |
---|---|
ConsoleColor | The closest |
Inverted(Color)
Returns a new
Declaration
public static Color Inverted(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to invert. |
Returns
Type | Description |
---|---|
Color | The inverted color. |
WithA(Color, Int32)
Returns a vector whose red, green, and blue components are the same as the specified color, and whose alpha component is a new value.
Declaration
public static Color WithA(this Color color, int a)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to copy. |
System.Int32 | a | The new alpha component value. |
Returns
Type | Description |
---|---|
Color | A new instance of |
WithB(Color, Int32)
Returns a vector whose red, green, and alpha components are the same as the specified color, and whose blue component is a new value.
Declaration
public static Color WithB(this Color color, int b)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to copy. |
System.Int32 | b | The new blue component value. |
Returns
Type | Description |
---|---|
Color | A new instance of |
WithG(Color, Int32)
Returns a vector whose red, blue, and alpha components are the same as the specified color, and whose green component is a new value.
Declaration
public static Color WithG(this Color color, int g)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to copy. |
System.Int32 | g | The new green component value. |
Returns
Type | Description |
---|---|
Color | A new instance of |
WithR(Color, Int32)
Returns a vector whose green, blue, and alpha components are the same as the specified color, and whose red component is a new value.
Declaration
public static Color WithR(this Color color, int r)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to copy. |
System.Int32 | r | The new red component value. |
Returns
Type | Description |
---|---|
Color | A new instance of |