A'Hote Color Scheme Library


A'Hote is a C++ library for generating color schemes and also includes a few other classes for converting between RGB (Red, Green, Blue), YUV (Luminance and Chrominance), HSB (Hue, Saturation, Brightness) and HSL (Hue, Saturation, Lightness).

This is not a library for ICC color management.

Color Schemes

A variety of functions are provided that, in general, take an input HSB color as a parameter and return a std::vector of HSB colors representing the generated color scheme. Depending on the function a number of other parameters can be passed that will vary the return size of the color scheme, etc.

The HSB colors in the returned std::vector can then be used as necessary. The HSB class can be cast to the RGB class, performing all necessary conversions along the way. Thus, it would be possible to do something like the following:

using namespace ahote;
// std::vector<HSB> has been typedefed to Colors
Colors scheme = tetrads( HSB(120, 1.0, 1.0) );
RGB rgb;
for (Colors::iterator iter=scheme.begin(); iter != scheme.end(); iter++) {
  rgb = *iter;
  // rgb.red, rgb.green, rgb.blue contain the RGB components
  // do something meaningful with them, like:
  cairo_set_source_rgb(cairo, rgb.red, rgb.green, rgb.blue);

The following image was drawn by in cairo using code similar to the above:

The following illustrates a number of the color schemes that can be generated from a single function call. All images were created using the A'Hote library and drawn onto cairo png surfaces. See examples/color_schemes for the example program that created all these images.

From the RGB Color Wheel

Schemes of schemes

The color scheme methods are overloaded to accept not only a starting or seed color, but an entire scheme as well. The following schemes were generated by feeding one scheme into another scheme.

SourceForge.net Logo     Support This Project     Valid XHTML 1.0!