ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
palette.hpp
Go to the documentation of this file.
1 #ifndef H_PALETTE
2 #define H_PALETTE
3 
4 #include <string>
5 
6 #include "RtypesCore.h"
7 
8 class Palette{
9 public:
10  Palette(const std::string &file,
11  const std::string &palette);
12  explicit Palette(const std::string &palette = "default");
13  Palette(const Palette &) = default;
14  Palette & operator=(const Palette &) = default;
15  Palette(Palette &&) = default;
16  Palette & operator=(Palette &&) = default;
17  ~Palette() = default;
18 
19  const std::string & File() const;
20  Palette & File(const std::string &file);
21 
22  const std::string & PaletteName() const;
23  Palette & PaletteName(const std::string &palette);
24  Palette & PaletteName(const std::string &file,
25  const std::string &palette);
26 
27  Int_t operator()(const std::string &color_name) const;
28 
29  static Int_t RGB(Int_t r, Int_t g, Int_t b);
30  static Int_t RGB(Float_t r, Float_t g, Float_t b);
31 
32  static Int_t HSV(Float_t h, Float_t s, Float_t v);
33 
34  static Int_t HLS(Int_t h, Int_t l, Int_t s);
35  static Int_t HLS(Float_t h, Float_t l, Float_t s);
36 
37 private:
38  std::string file_;
39  std::string palette_;
40 };
41 
42 #endif
Int_t operator()(const std::string &color_name) const
Gets the ROOT color number corresponding to a color in the configuration file.
Definition: palette.cpp:104
const std::string & PaletteName() const
Get the name of the palette from which colors are read.
Definition: palette.cpp:67
~Palette()=default
std::string palette_
Palette name from which to read color definitions.
Definition: palette.hpp:39
const std::string & File() const
Get the file from which colors are read.
Definition: palette.cpp:48
std::string file_
File from which to read color definitions.
Definition: palette.hpp:38
static Int_t RGB(Int_t r, Int_t g, Int_t b)
Gets the ROOT color number corresponding to a given RGB color.
Definition: palette.cpp:149
Palette(const std::string &file, const std::string &palette)
Construct from file and palette names.
Definition: palette.cpp:28
Palette & operator=(const Palette &)=default
static Int_t HLS(Int_t h, Int_t l, Int_t s)
Gets the ROOT color number corresponding to a given HLS/HSL color.
Definition: palette.cpp:193
static Int_t HSV(Float_t h, Float_t s, Float_t v)
Gets the ROOT color number corresponding to a given HSV color.
Definition: palette.cpp:177
Loads colors from a text configuration file.
Definition: palette.hpp:8