xlnt
Public Member Functions | List of all members
xlnt::rgb_color Class Reference

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...
 

Detailed Description

An RGB color describes a color in terms of its red, green, blue, and alpha components.

Constructor & Destructor Documentation

◆ rgb_color() [1/2]

xlnt::rgb_color::rgb_color ( const std::string &  hex_string)

Constructs an RGB color from a string in the form #[aa]rrggbb

◆ rgb_color() [2/2]

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.

Member Function Documentation

◆ alpha()

std::uint8_t xlnt::rgb_color::alpha ( ) const

Returns a byte representing the alpha component of this color

◆ blue()

std::uint8_t xlnt::rgb_color::blue ( ) const

Returns a byte representing the blue component of this color

◆ green()

std::uint8_t xlnt::rgb_color::green ( ) const

Returns a byte representing the red component of this color

◆ hex_string()

std::string xlnt::rgb_color::hex_string ( ) const

Returns a string representation of this color in the form #aarrggbb

◆ red()

std::uint8_t xlnt::rgb_color::red ( ) const

Returns a byte representing the red component of this color

◆ rgb()

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.

◆ rgba()

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.


The documentation for this class was generated from the following file: