Color class
Color class
The Color class lets you specify colors as Red-Green-Blue (RGB) values, Hue-Saturation-Luminosity (HSL) values, Hue-Saturation-Value (HSV) values, Hue-Whiteness-Blackness (HWB) values, lightness-A-B (LAB) values, Luminance-Chroma-Hue (LCH) values, Cyan-Magenta-Yellow-Key (CMYK) values, Natural colors (NCOL) values, or with a color name. An Alpha channel is also available to indicate transparency.
The Color type exposes the following members:
Constructors
| Constructor | Description |
|---|---|
| init | Initializes a new instance of the Color class.By default color is black. |
| init | Initializes a new instance of the Color class.All color components must be in the range 0-1. |
| init | Initializes a new instance of the Color class.All color components must be in the range 0-1. |
| init | Initializes a new instance of the Color class.All color components must be in the range 0-255. |
| init | Initializes a new instance of the Color class.All color components must be in the range 0-255. |
| init | Initializes a new instance of the Color class.All color components must be in the range 0-255. |
| init | Initializes a new instance of the Color class.All color components must be in the range 0-255. |
Properties
| Property | Description |
|---|---|
| red | Represents the red component of the color |
| green | Represents the green component of the color. |
| blue | Represents the blue component of the color. |
| alpha | Represents the alpha component of the color. |
Methods
| Method | Description |
|---|---|
| from_rgb | Returns a new Color with the requested ged, green, blue values. All color components must be in the range 0-255. |
| from_rgb | Returns a new Color with the requested ged, green, blue values. All color components must be in the range 0-255. |
| from_rgb | Returns a new Color with the requested ged, green, blue values. All color components must be in the range 0-1. |
| from_rgba | Returns a new Color with the requested ged, green, blue, alpha values. All color components must be in the range 0-255. |
| from_rgba | Returns a new Color with the requested ged, green, blue, alpha values. All color components must be in the range 0-255. |
| from_rgba | Returns a new Color with the requested ged, green, blue, alpha values. All color components must be in the range 0-1. |
| from_gray | Returns a new Color with the requested gray value. |
| from_uint | Returns a new Color with the requested ARGB value. |
| from_int | Returns a new Color with the requested ARGB value. |
| from_string | Parses string containing the CSS color and returns a new Color. |
| from_hsl | Returns a new Color with the requested hue, saturation, saturation values. |
| from_hsla | Returns a new Color with the requested hue, saturation, saturation, alpha values. |
| from_hsv | Returns a new Color with the requested hue, saturation, value. |
| from_hsva | Returns a new Color with the requested hue, saturation, value, alpha. |
| from_hwb | Returns a new Color with the requested hue, whiteness, blackness values. |
| from_hwba | Returns a new Color with the requested hue, whiteness, blackness values. |
| from_cmyk | Returns a new Color with the requested cyan, magenta, yellow, key (black) values. |
| from_cmyka | Returns a new Color with the requested cyan, magenta, yellow, key (black), alpha values. |
| from_lab | Returns a new Color with the requested lightness, A, B values. |
| from_laba | Returns a new Color with the requested lightness, A, B, alpha values. |
| from_oklab | Returns a new Color with the requested lightness, A, B values for OKLAB model. |
| from_oklaba | Returns a new Color with the requested lightness, A, B, alpha values for OKLAB model. |
| from_lch | Returns a new Color with the requested luminance, chroma, hue values. |
| from_lcha | Returns a new Color with the requested luminance, chroma, hue, alpha values. |
| from_oklch | Returns a new Color with the requested luminance, chroma, hue values for OKLAB model. |
| from_oklcha | Returns a new Color with the requested luminance, chroma, hue, alpha values for OKLAB model. |
| to_rgb_hex_string | Returns a hexadecimal color is specified with: #RRGGBB. |
| to_natural_color_string | Returns a Natural colors (NCol) specified color using a color letter with a number to specify the distance (in percent) from the color. |
| to_name | Returns the name of the color if it matches a color in the list of CSS named colors, or an empty string. |
| convert | Returns a color components in the format of the specified color model. |
| to_rgb_string | Returns a string containing the RGB color specified by: rgb(R, G, B). |
| to_rgba_hex_string | Returns a Hexadecimal color is specified with: #RRGGBBAA. |
| to_rgba_string | Returns a string containing the RGBA color specified by: rgba(R, G, B, A). |
| to_int | Encodes the Color ARGB components into int. |
| to_uint | Encodes the Color ARGB components into unsigned int. |
| get_luminosity | Returns a luminosity of the Color. |
| add_luminosity | Creates copy of the Color with Sum of its luminosity and the delta value. |
| with_luminosity | Creates copy of the Color with specified luminosity. |
| with_alpha | Creates copy of the Color with specified alpha component. |
| get_saturation | Returns a saturation of the Color. |
| with_saturation | Creates copy of the Color with specified saturation. |
| get_hue | Returns a Hue of the Color. |
| with_hue | Creates copy of the Color with specified Hue. |
| get_complementary | Returns a new color that is on the opposite side of the color wheel from the original. |
See Also
- module
aspose.svg.drawing - class
Color