Bridges-C++
3.4.2
Bridges(C++ API)
|
#include <Color.h>
This class represents Color, and supports rgba, hexadecimal and named color values.
This class contains functions for the manipulation of a Color representation.
Supported rgba colors are integer representations of each color channel, in the range of [0,255]. rgb input is also supported, and given a default alpha value of 255 (opaque)
Supported Hexadecimal colors are in the form "#RRGGBBAA", "#RRGGBB", "#RGBA", or "#RGB". With R,G,B and A, representing the Red, Green, Blue, and Alpha color channels respectivly, in hexadecimal digits(0-9a-f, base 16) prefixed by '#'. "#RGBA" and "#RGB" are shorthand versions of "#RRGGBBAA" and "#RRGGBB", where each channel pair is the same. If no alpha channel is provided, a default of 'ff'(opaque) will be used
Supported named colors are as follows and illustrated at Supported named colors are listed here: https://drafts.csswg.org/css-color-3/#svg-color
aliceblue, antiquewhite, cyan, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, darkblue, darkcyan, darkgoldenrod, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, magenta, gainsboro, ghostwhite, gold, goldenrod, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
All named colors have are fully opaque by default.
Default Color is opaque white
Public Member Functions | |
Color () | |
Color (const int r, const int g, const int b, const int a=255) | |
Color (const string &name) | |
bool | operator== (const Color &that) const |
bool | operator!= (const Color &that) const |
bool | isOpaque () const |
bool | isTransparent () const |
int | getRed () const |
int | getGreen () const |
int | getBlue () const |
int | getAlpha () const |
string | getHexValue () const |
void | setRed (int r) |
void | setGreen (int g) |
void | setBlue (int b) |
void | setAlpha (int a) |
void | setValue (int r, int g, int b, int a=255) |
void | setValue (string name) |
const string | getRepresentation () const |
const string | getCSSRepresentation () const |
|
inline |
Default constructor Defaults to black
|
inline |
Constructs a color with the specified rgba color channel values [0,255]. If no alpha channel is provided, the default of 255(opaque) is used.
r | The red channel |
g | The green channel |
b | The blue channel |
a | The alpha channel(default 255) |
|
inline |
Constructs a color from a named color or a "#hexadecimal" [0-F](base 16) of the form "#RRGGBBAA", "#RRGGBBAA", "#RGBA", or "#RGB". Named colors and "#hexadecimals" missing an alpha channel are made opaque.
name | The named color or "#hexadecimal" value |
|
inline |
Get alpha component
|
inline |
Get blue component
|
inline |
Gets the CSS representation of this color
|
inline |
Get green component
|
inline |
|
inline |
Get red component
|
inline |
|
inline |
|
inline |
Checks for transparency
|
inline |
Inequality Comparison Operator
|
inline |
Equality Comparison Operator
|
inline |
Sets alpha channel to "a"
a | rgba value to set alpha channel |
|
inline |
Sets blue channel to "b"
b | rgba value to set blue channel |
|
inline |
Sets green channel to "g"
g | rgba value to set green channel |
|
inline |
Sets red channel to "r"
r | rgba value to set red channel |
|
inline |
Sets this color's value to the specified rgba color channel values [0,255]. If no alpha channel is provided, the default of 255(opaque) is used.
r | rgba value to set the red channel |
g | rgba value to set the green channel |
b | rgba value to set the blue channel |
a | rgba value to set the alpha channel |
|
inline |
Sets this color's value to the value of a named color or a "#hexadecimal" [0-F](base 16) of the form "#RRGGBBAA", "#RRGGBBAA", "#RGBA", or "#RGB". Named colors and "#hexadecimals" missing an alpha channel are made opaque.
name | The named color or "#hexadecimal" value |
string | If name is an invalid color |