A library for working with phylogenetic and population genetic data.
v0.27.0
utils/tools/color/functions.hpp File Reference

Detailed Description

Color operators and functions.

Definition in file utils/tools/color/functions.hpp.

#include <iosfwd>
#include <map>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

Color 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, green and blue, and optionally alpha. More...
 
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]". More...
 
std::string color_to_hex (Color const &c, std::string const &prefix="#", bool uppercase=false, bool with_alpha=false)
 Return a hex string representation of a Color in the format "#003366[ff]". More...
 
Color gradient (std::map< double, Color > const &ranges, double value)
 Returns a Color that is created using a color gradient. More...
 
Color heat_gradient (double percentage)
 Return a Color that represents a heat gradient for a given percentage value. More...
 
Color interpolate (Color const &color1, Color const &color2, double fraction)
 Linearily interpolate between two Colors. More...
 
std::ostream & operator<< (std::ostream &os, Color const &h)
 Write a textual representation of the Color the a stream, in the format "(r, g, b, a)". More...
 
Color resolve_color_string (std::string const &color_str)
 Resolve a string representing a color. More...