|
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_FUNCTIONS_H_
2 #define GENESIS_UTILS_COLOR_FUNCTIONS_H_
56 Color
color_from_bytes(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a = 255 );
65 Color
color_from_hex( std::string
const& hex_color, std::string
const& prefix =
"#" );
77 std::string
const& prefix =
"#",
78 bool uppercase =
false,
79 bool with_alpha =
false
89 std::ostream&
operator<< ( std::ostream& os, Color
const& h );
106 Color
interpolate (Color
const& color1, Color
const& color2,
double fraction);
139 Color
gradient ( std::map<double, Color>
const& ranges,
double value );
153 #endif // include guard
Color 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]".
std::ostream & operator<<(std::ostream &os, Color const &color)
Write a textual representation of the Color the a stream, in the format "(r, g, b,...
Color gradient(std::map< double, Color > const &ranges, double value)
Returns a Color that is created using a color gradient.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Color heat_gradient(double percentage)
Return a Color that represents a heat gradient for a given percentage value.
Color interpolate(Color const &color1, Color const &color2, double fraction)
Linearily interpolate between two Colors.
Color color_from_bytes(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Create a Color given three or four values in the range [ 0, 255 ] for each of the components red,...
Color resolve_color_string(std::string const &color_str)
Resolve a string representing a color.
std::string color_to_hex(Color const &c, std::string const &prefix, bool uppercase, bool with_alpha)
Return a hex string representation of a Color in the format "#003366[ff]".