Belle II Software  release-08-01-10
Colors Class Reference

Utility functions related to colors. More...

#include <Colors.h>

Static Public Member Functions

static std::vector< std::string > getList ()
 Get a list of useful colors.
 
static double hueToRgb (double p, double q, double t)
 Transforms a Color given in the HLS System to RGB.
 
static std::array< double, 3 > hlsToRgb (double h, double l, double s)
 Transforms a Color given in the HLS System to RGB. More...
 
static std::string getWheelColor (int degree)
 Get a color from the wheel of colors. More...
 

Detailed Description

Utility functions related to colors.

Definition at line 22 of file Colors.h.

Member Function Documentation

◆ getWheelColor()

std::string getWheelColor ( int  degree)
static

Get a color from the wheel of colors.

Parameters
degreethe degree viewed form the center of the color wheel (greater 0)

Definition at line 71 of file Colors.cc.

72 {
73  double hue(degree % 360 / 360.);
74  double saturation = 0.75;
75  double lightness = 0.5;
76 
77  std::array<double, 3> rgb = Colors::hlsToRgb(hue, lightness, saturation);
78  std::ostringstream oss;
79  oss << "rgb(" << rgb[0] * 100 << "%, " << rgb[1] * 100 << "%, " << rgb[2] * 100 << "%)";
80  return oss.str();
81 }
static std::array< double, 3 > hlsToRgb(double h, double l, double s)
Transforms a Color given in the HLS System to RGB.
Definition: Colors.cc:56

◆ hlsToRgb()

std::array< double, 3 > hlsToRgb ( double  h,
double  l,
double  s 
)
static

Transforms a Color given in the HLS System to RGB.

Parameters
hHue ranging from 0 to 1.
lLighness.
sSaturation.
Returns
Array containing rgb-values in the order red, green, blue.

Definition at line 56 of file Colors.cc.


The documentation for this class was generated from the following files: