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

Detailed Description

Color operators and functions.

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

#include "genesis/utils/tools/color/functions.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include "genesis/utils/text/string.hpp"
#include "genesis/utils/tools/color.hpp"
#include "genesis/utils/tools/color/names.hpp"

Go to the source code of this file.


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


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