xlnt
|
An RGB color describes a color in terms of its red, green, blue, and alpha components. More...
#include <color.hpp>
Public Member Functions | |
rgb_color (const std::string &hex_string) | |
Constructs an RGB color from a string in the form #[aa]rrggbb More... | |
rgb_color (std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a=255) | |
Constructs an RGB color from red, green, and blue values in the range 0 to 255 plus an optional alpha which defaults to fully opaque. More... | |
std::string | hex_string () const |
Returns a string representation of this color in the form #aarrggbb More... | |
std::uint8_t | red () const |
Returns a byte representing the red component of this color More... | |
std::uint8_t | green () const |
Returns a byte representing the red component of this color More... | |
std::uint8_t | blue () const |
Returns a byte representing the blue component of this color More... | |
std::uint8_t | alpha () const |
Returns a byte representing the alpha component of this color More... | |
std::array< std::uint8_t, 3 > | rgb () const |
Returns the red, green, and blue components of this color separately in an array in that order. More... | |
std::array< std::uint8_t, 4 > | rgba () const |
Returns the red, green, blue, and alpha components of this color separately in an array in that order. More... | |
An RGB color describes a color in terms of its red, green, blue, and alpha components.
xlnt::rgb_color::rgb_color | ( | const std::string & | hex_string | ) |
Constructs an RGB color from a string in the form #[aa]rrggbb
xlnt::rgb_color::rgb_color | ( | std::uint8_t | r, |
std::uint8_t | g, | ||
std::uint8_t | b, | ||
std::uint8_t | a = 255 |
||
) |
Constructs an RGB color from red, green, and blue values in the range 0 to 255 plus an optional alpha which defaults to fully opaque.
std::uint8_t xlnt::rgb_color::alpha | ( | ) | const |
Returns a byte representing the alpha component of this color
std::uint8_t xlnt::rgb_color::blue | ( | ) | const |
Returns a byte representing the blue component of this color
std::uint8_t xlnt::rgb_color::green | ( | ) | const |
Returns a byte representing the red component of this color
std::string xlnt::rgb_color::hex_string | ( | ) | const |
Returns a string representation of this color in the form #aarrggbb
std::uint8_t xlnt::rgb_color::red | ( | ) | const |
Returns a byte representing the red component of this color
std::array<std::uint8_t, 3> xlnt::rgb_color::rgb | ( | ) | const |
Returns the red, green, and blue components of this color separately in an array in that order.
std::array<std::uint8_t, 4> xlnt::rgb_color::rgba | ( | ) | const |
Returns the red, green, blue, and alpha components of this color separately in an array in that order.