|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_COLOR_COLOR_H_
2 #define GENESIS_UTILS_COLOR_COLOR_H_
59 : r_( 0.0 ), g_( 0.0 ), b_( 0.0 ), a_( 1.0 )
72 Color(
double r,
double g,
double b,
double a );
98 static Color from_bytes(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a = 255 );
103 static Color from_hex( std::string
const& hex_color, std::string
const& prefix =
"#" );
131 return to_byte_( r_ );
136 return to_byte_( g_ );
141 return to_byte_( b_ );
146 return to_byte_( a_ );
153 void r (
double value);
155 void g (
double value);
157 void b (
double value);
159 void a (
double value);
163 r_ = from_byte_( value );
168 g_ = from_byte_( value );
173 b_ = from_byte_( value );
178 a_ = from_byte_( value );
187 static unsigned char to_byte_(
double v );
188 static double from_byte_(
unsigned char v );
226 return !(lhs == rhs);
232 #endif // include guard
Color(double r, double g, double b)
Constructor for setting the RGB value.
static Color from_hex(std::string const &hex_color, std::string const &prefix="#")
Create a Color given a hex color string in the format "#003366[ff]".
unsigned char a_byte() const
void swap(Color &lhs, Color &rhs)
bool operator!=(Color const &lhs, Color const &rhs)
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
unsigned char b_byte() const
void g_byte(unsigned char value)
void a_byte(unsigned char value)
unsigned char g_byte() const
bool operator==(Color const &lhs, Color const &rhs)
Color()
Default constructor. Sets the color to black.
unsigned char r_byte() const
Color & operator=(Color const &)=default
static Color from_bytes(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Create a Color given three or four values in the range [ 0, 255 ] for each of the components red,...
void b_byte(unsigned char value)
void r_byte(unsigned char value)