12 std::vector<const RootPalette*>& fixedPals() {
13 static std::vector<const RootPalette*> pals(3000,
nullptr);
24 static bool first =
true;
29 return fixedPals()[0];
35 if ( ipal >= fixedPals().
size() )
return nullptr;
36 if ( fixedPals()[ipal] !=
nullptr )
return fixedPals()[ipal];
40 }
else if ( ipal < 1000 ) {
41 if ( fixedPals()[ipal] ==
nullptr ) {
44 }
else if ( (ipal >= 1010 && ipal < 1020) ||
45 (ipal >= 2010 && ipal < 2020) ) {
46 TStyle* pstyleSave = gStyle;
47 gStyle =
dynamic_cast<TStyle*
>(gStyle->Clone(
"TmpStyle"));
48 TStyle* pstyleTmp = gStyle;
49 const double alpha = 1.0;
52 Double_t
stops[nRGBs] = { 0.00, 0.30, 0.44, 0.70, 1.00};
53 Double_t red[nRGBs] = { 1.00, 1.00, 1.00, 0.70, 0.00};
54 Double_t green[nRGBs] = { 1.00, 0.75, 0.55, 0.20, 0.00};
55 Double_t blue[nRGBs] = { 1.00, 0.00, 0.00, 0.10, 0.00};
66 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, ncol, alpha);
68 vector<unsigned int> ncfxs = {0, 1, 2, 4, 6, 8, 10, 20, 30, 40};
69 int ipal0 = ipal < 2000 ? 1010 : 2010;
71 fixedPals()[ipal] = ppal;
74 }
else if ( (ipal >= 1020 && ipal < 1030) ||
75 (ipal >= 2020 && ipal < 2030) ) {
76 TStyle* pstyleSave = gStyle;
77 gStyle =
dynamic_cast<TStyle*
>(gStyle->Clone(
"TmpStyle"));
78 TStyle* pstyleTmp = gStyle;
79 const double alpha = 1.0;
82 Double_t
stops[nRGBs] = { 0.00, 0.50, 0.50, 0.65, 0.72, 0.85, 1.00};
83 Double_t red[nRGBs] = { 0.09, 0.90, 1.00, 1.00, 1.00, 0.70, 0.00};
84 Double_t green[nRGBs] = { 0.60, 0.95, 1.00, 0.75, 0.55, 0.20, 0.00};
85 Double_t blue[nRGBs] = { 0.48, 1.00, 1.00, 0.00, 0.00, 0.10, 0.00};
104 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, ncol, alpha);
106 vector<unsigned int> ncfxs = {0, 1, 2, 4, 6, 8, 10, 20, 30, 40};
107 int ipal0 = ipal < 2000 ? 1020 : 2020;
109 fixedPals()[ipal] = ppal;
113 return fixedPals()[ipal];
119 unsigned int ipal = ipalin >= 0 ? ipalin : -ipalin;
121 if ( ipal >= fixedPals().
size() )
return false;
125 if ( ppal ==
nullptr && ipal > 0 && ipal < 1000 ) {
127 fixedPals()[ipal] = ppal;
130 if ( ipalin < 0 ) TColor::InvertPalette();
169 if ( pstyle ==
nullptr )
return 2;
170 unsigned int nscol = pstyle->GetNumberOfColors();
171 if ( nscol == 0 )
return 1;
172 for (
unsigned int icol=0; icol<nscol; ++icol )
m_cols.push_back(pstyle->GetColorPalette(icol));
185 if ( pstyle ==
nullptr )
return 2;
187 if ( ipal >0 && ipal < 1000 ) {
188 pstyle->SetPalette(ipal);
189 }
else if (
ncol() == 0 ) {
193 for (
unsigned int icol=0; icol<
ncol(); ++icol ) cols[icol] =
m_cols[icol];
194 pstyle->SetPalette(
ncol(), &cols[0]);
208 unsigned int icz =
ncol()/2;
209 unsigned int icfx1 = icz > ncfx ? icz - ncfx : 0;
210 unsigned int icfx2 = icz + ncfx;
211 if ( 2*icz +
ncol() ) icfx2 -= 1;
212 if ( icfx2 >
ncol() ) icfx2 =
ncol();
213 for (
unsigned int icfx=icfx1; icfx<icz+ncfx; ++icfx )
mutableColorVector()[icfx] = icol;
static bool set(int ipal)
std::vector< int > & mutableColorVector()
static const RootPalette * defaultPalette()
unsigned int ncol() const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void setCentralColors(unsigned int ncol, unsigned int icol=0)
std::vector< int > m_cols
int setRootPalette() const
void setFirstColors(unsigned int ncol, unsigned int icol=0)
static const RootPalette * find(unsigned int ipal)
int rootPaletteIndex() const