Belle II Software development
Belle2::TangoPalette Namespace Reference

Implements a colour palette, see http://sobac.com/sobac/tangocolors.htm. More...

Functions

const char * getHex (const std::string &tangoName, int tangoId=1)
 Get six-digit hex code (#abcdef) for given name in tango colour palette.
 
int getTColorID (const std::string &tangoName, int tangoId=1)
 Get TColor ID for given name in tango colour palette.
 

Detailed Description

Implements a colour palette, see http://sobac.com/sobac/tangocolors.htm.

Functions take a name (Aluminium, Slate, Chameleon, ...) and an ID (1: light, 2: medium, 3: dark) Invalid names/id produce an exception.

Function Documentation

◆ getHex()

const char * getHex ( const std::string &  tangoName,
int  tangoId = 1 
)

Get six-digit hex code (#abcdef) for given name in tango colour palette.

e.g. getHex("Aluminium", 3) returns "\#eeeeec".

Definition at line 18 of file ColorPalette.cc.

19 {
20 using ColorTuple = std::array<const char*, 3>;
21 static std::map<std::string, ColorTuple> tango;
22 if (tango.empty()) {
23 tango["Aluminium"] = ColorTuple({"#eeeeec", "#d3d7cf", "#babdb6"});
24 tango["Butter"] = ColorTuple({"#fce94f", "#edd400", "#c4a000"});
25 tango["Chameleon"] = ColorTuple({"#8ae234", "#73d216", "#4e9a06"});
26 tango["Orange"] = ColorTuple({"#fcaf3e", "#f57900", "#ce5c00"});
27 tango["Chocolate"] = ColorTuple({"#e9b96e", "#c17d11", "#8f5902"});
28 tango["Sky Blue"] = ColorTuple({"#729fcf", "#3465a4", "#204a87"});
29 tango["Plum"] = ColorTuple({"#ad7fa8", "#75507b", "#5c3566"});
30 tango["Slate"] = ColorTuple({"#888a85", "#555753", "#2e3436"});
31 tango["Scarlet Red"] = ColorTuple({"#ef2929", "#cc0000", "#a40000"});
32 }
33
34 if (tangoId < 1 or tangoId > 3)
35 throw std::runtime_error("tangoId must be 1, 2, or 3!");
36 return tango.at(tangoName)[tangoId - 1];
37 }

◆ getTColorID()

int getTColorID ( const std::string &  tangoName,
int  tangoId = 1 
)

Get TColor ID for given name in tango colour palette.

Use this for setting colours for ROOT objects.

Definition at line 39 of file ColorPalette.cc.

40 {
41 return TColor::GetColor(getHex(tangoName, tangoId));
42 }
const char * getHex(const std::string &tangoName, int tangoId=1)
Get six-digit hex code (#abcdef) for given name in tango colour palette.
Definition: ColorPalette.cc:18