29 static Bool_t& TColor__GrayScaleMode() {
30 static Bool_t grayScaleMode;
33 static TArrayI& TColor__Palette() {
34 static TArrayI globalPalette(0);
37 static TArrayD& TColor__PalettesList() {
38 static TArrayD globalPalettesList(0);
39 return globalPalettesList;
43 static Int_t gHighestColorIndex = 0;
44 static Float_t gColorThreshold = -1.;
45 static Int_t gDefinedColors = 0;
46 static Int_t gLastDefinedColors = 649;
48 #define fgGrayscaleMode TColor__GrayScaleMode()
49 #define fgPalette TColor__Palette()
50 #define fgPalettesList TColor__PalettesList()
983 TColor::TColor(): TNamed()
986 fRed = fGreen = fBlue = fHue = fLight = fSaturation = -1;
994 TColor::TColor(Int_t color, Float_t r, Float_t g, Float_t b,
const char *name,
998 TColor::InitializeColors();
1000 TColor *col = gROOT->GetColor(color);
1002 Warning(
"TColor",
"color %d already defined", color);
1003 fNumber = col->GetNumber();
1004 fRed = col->GetRed();
1005 fGreen = col->GetGreen();
1006 fBlue = col->GetBlue();
1007 fHue = col->GetHue();
1008 fLight = col->GetLight();
1009 fAlpha = col->GetAlpha();
1010 fSaturation = col->GetSaturation();
1016 if (fNumber > gHighestColorIndex) gHighestColorIndex = fNumber;
1019 if (!name || !*name) {
1020 snprintf(aname,32,
"Color%d", color);
1025 TObjArray *lcolors = (TObjArray*)gROOT->GetListOfColors();
1026 lcolors->AddAtAndExpand(
this, color);
1039 TColor::TColor(Float_t r, Float_t g, Float_t b, Float_t a): TNamed(
"",
"")
1041 gHighestColorIndex++;
1042 fNumber = gHighestColorIndex;
1047 RGBtoHLS(r, g, b, fHue, fLight, fSaturation);
1050 TObjArray *lcolors = (TObjArray*)gROOT->GetListOfColors();
1051 lcolors->AddAtAndExpand(
this, fNumber);
1060 gROOT->GetListOfColors()->Remove(
this);
1061 if (gROOT->GetListOfColors()->GetEntries() == 0) {fgPalette.Set(0); fgPalette=0;}
1067 TColor::TColor(
const TColor &color) : TNamed(color)
1069 ((TColor&)color).Copy(*
this);
1072 TColor &TColor::operator=(
const TColor &color)
1074 ((TColor &)color).Copy(*
this);
1083 void TColor::InitializeColors()
1085 static Bool_t initDone = kFALSE;
1087 if (initDone)
return;
1090 if (gROOT->GetListOfColors()->First() == 0) {
1092 new TColor(kWhite,1,1,1,
"background");
1093 new TColor(kBlack,0,0,0,
"black");
1094 new TColor(2,1,0,0,
"red");
1095 new TColor(3,0,1,0,
"green");
1096 new TColor(4,0,0,1,
"blue");
1097 new TColor(5,1,1,0,
"yellow");
1098 new TColor(6,1,0,1,
"magenta");
1099 new TColor(7,0,1,1,
"cyan");
1100 new TColor(10,0.999,0.999,0.999,
"white");
1101 new TColor(11,0.754,0.715,0.676,
"editcol");
1105 TColor::GetColorDark(10);
1106 TColor *c110 = gROOT->GetColor(110);
1107 if (c110) c110->SetRGB(0.999,0.999,.999);
1110 new TColor(20,0.8,0.78,0.67);
1111 new TColor(31,0.54,0.66,0.63);
1112 new TColor(41,0.83,0.81,0.53);
1113 new TColor(30,0.52,0.76,0.64);
1114 new TColor(32,0.51,0.62,0.55);
1115 new TColor(24,0.70,0.65,0.59);
1116 new TColor(21,0.8,0.78,0.67);
1117 new TColor(47,0.67,0.56,0.58);
1118 new TColor(35,0.46,0.54,0.57);
1119 new TColor(33,0.68,0.74,0.78);
1120 new TColor(39,0.5,0.5,0.61);
1121 new TColor(37,0.43,0.48,0.52);
1122 new TColor(38,0.49,0.6,0.82);
1123 new TColor(36,0.41,0.51,0.59);
1124 new TColor(49,0.58,0.41,0.44);
1125 new TColor(43,0.74,0.62,0.51);
1126 new TColor(22,0.76,0.75,0.66);
1127 new TColor(45,0.75,0.51,0.47);
1128 new TColor(44,0.78,0.6,0.49);
1129 new TColor(26,0.68,0.6,0.55);
1130 new TColor(28,0.53,0.4,0.34);
1131 new TColor(25,0.72,0.64,0.61);
1132 new TColor(27,0.61,0.56,0.51);
1133 new TColor(23,0.73,0.71,0.64);
1134 new TColor(42,0.87,0.73,0.53);
1135 new TColor(46,0.81,0.37,0.38);
1136 new TColor(48,0.65,0.47,0.48);
1137 new TColor(34,0.48,0.56,0.6);
1138 new TColor(40,0.67,0.65,0.75);
1139 new TColor(29,0.69,0.81,0.78);
1142 new TColor(8, 0.35,0.83,0.33);
1143 new TColor(9, 0.35,0.33,0.85);
1144 new TColor(12,.3,.3,.3,
"grey12");
1145 new TColor(13,.4,.4,.4,
"grey13");
1146 new TColor(14,.5,.5,.5,
"grey14");
1147 new TColor(15,.6,.6,.6,
"grey15");
1148 new TColor(16,.7,.7,.7,
"grey16");
1149 new TColor(17,.8,.8,.8,
"grey17");
1150 new TColor(18,.9,.9,.9,
"grey18");
1151 new TColor(19,.95,.95,.95,
"grey19");
1152 new TColor(50, 0.83,0.35,0.33);
1161 Float_t saturation = 1;
1162 Float_t lightness = 0.5;
1163 Float_t maxHue = 280;
1165 Int_t maxPretty = 50;
1167 Float_t r=0., g=0., b=0., h, l, s;
1169 for (i=0 ; i<maxPretty-1 ; i++) {
1170 hue = maxHue-(i+1)*((maxHue-minHue)/maxPretty);
1171 TColor::HLStoRGB(hue, lightness, saturation, r, g, b);
1172 new TColor(i+51, r, g, b);
1177 for (i = 1; i < 8; i++) {
1178 s0 = gROOT->GetColor(i);
1179 if (s0) s0->GetRGB(r,g,b);
1180 if (i == 1) { r = 0.6; g = 0.6; b = 0.6; }
1181 if (r == 1) r = 0.9;
else if (r == 0) r = 0.1;
1182 if (g == 1) g = 0.9;
else if (g == 0) g = 0.1;
1183 if (b == 1) b = 0.9;
else if (b == 0) b = 0.1;
1184 TColor::RGBtoHLS(r,g,b,h,l,s);
1185 TColor::HLStoRGB(h,0.6*l,s,r,g,b);
1186 new TColor(200+4*i-3,r,g,b);
1187 TColor::HLStoRGB(h,0.8*l,s,r,g,b);
1188 new TColor(200+4*i-2,r,g,b);
1189 TColor::HLStoRGB(h,1.2*l,s,r,g,b);
1190 new TColor(200+4*i-1,r,g,b);
1191 TColor::HLStoRGB(h,1.4*l,s,r,g,b);
1192 new TColor(200+4*i ,r,g,b);
1196 TColor::CreateColorWheel();
1201 if (!fgPalette.fN) SetPalette(1,0);
1209 const char *TColor::AsHexString()
const
1211 static TString tempbuf;
1214 r = Int_t(GetRed() * 255);
1215 g = Int_t(GetGreen() * 255);
1216 b = Int_t(GetBlue() * 255);
1217 a = Int_t(fAlpha * 255);
1220 tempbuf.Form(
"#%02x%02x%02x%02x", a, r, g, b);
1222 tempbuf.Form(
"#%02x%02x%02x", r, g, b);
1230 void TColor::Copy(TObject &obj)
const
1232 TNamed::Copy((TNamed&)obj);
1233 ((TColor&)obj).fRed = fRed;
1234 ((TColor&)obj).fGreen = fGreen;
1235 ((TColor&)obj).fBlue = fBlue;
1236 ((TColor&)obj).fHue = fHue;
1237 ((TColor&)obj).fLight = fLight;
1238 ((TColor&)obj).fAlpha = fAlpha;
1239 ((TColor&)obj).fSaturation = fSaturation;
1240 ((TColor&)obj).fNumber = fNumber;
1246 void TColor::CreateColorsGray()
1248 if (gROOT->GetColor(kGray))
return;
1249 TColor *gray =
new TColor(kGray,204./255.,204./255.,204./255.);
1250 TColor *gray1 =
new TColor(kGray+1,153./255.,153./255.,153./255.);
1251 TColor *gray2 =
new TColor(kGray+2,102./255.,102./255.,102./255.);
1252 TColor *gray3 =
new TColor(kGray+3, 51./255., 51./255., 51./255.);
1253 gray ->SetName(
"kGray");
1254 gray1->SetName(
"kGray+1");
1255 gray2->SetName(
"kGray+2");
1256 gray3->SetName(
"kGray+3");
1262 void TColor::CreateColorsCircle(Int_t offset,
const char *name, UChar_t *rgb)
1265 for (Int_t n=0;n<15;n++) {
1266 Int_t colorn = offset+n-10;
1267 TColor *color = gROOT->GetColor(colorn);
1269 color =
new TColor(colorn,rgb[3*n]/255.,rgb[3*n+1]/255.,rgb[3*n+2]/255.);
1270 color->SetTitle(color->AsHexString());
1271 if (n>10) colorname.Form(
"%s+%d",name,n-10);
1272 else if (n<10) colorname.Form(
"%s-%d",name,10-n);
1273 else colorname.Form(
"%s",name);
1274 color->SetName(colorname);
1282 void TColor::CreateColorsRectangle(Int_t offset,
const char *name, UChar_t *rgb)
1285 for (Int_t n=0;n<20;n++) {
1286 Int_t colorn = offset+n-9;
1287 TColor *color = gROOT->GetColor(colorn);
1289 color =
new TColor(colorn,rgb[3*n]/255.,rgb[3*n+1]/255.,rgb[3*n+2]/255.);
1290 color->SetTitle(color->AsHexString());
1291 if (n>9) colorname.Form(
"%s+%d",name,n-9);
1292 else if (n<9) colorname.Form(
"%s-%d",name,9-n);
1293 else colorname.Form(
"%s",name);
1294 color->SetName(colorname);
1302 void TColor::CreateColorWheel()
1304 UChar_t magenta[46]= {255,204,255
1305 ,255,153,255, 204,153,204
1306 ,255,102,255, 204,102,204, 153,102,153
1307 ,255, 51,255, 204, 51,204, 153, 51,153, 102, 51,102
1308 ,255, 0,255, 204, 0,204, 153, 0,153, 102, 0,102, 51, 0, 51};
1310 UChar_t red[46] = {255,204,204
1311 ,255,153,153, 204,153,153
1312 ,255,102,102, 204,102,102, 153,102,102
1313 ,255, 51, 51, 204, 51, 51, 153, 51, 51, 102, 51, 51
1314 ,255, 0, 0, 204, 0, 0, 153, 0, 0, 102, 0, 0, 51, 0, 0};
1316 UChar_t yellow[46] = {255,255,204
1317 ,255,255,153, 204,204,153
1318 ,255,255,102, 204,204,102, 153,153,102
1319 ,255,255, 51, 204,204, 51, 153,153, 51, 102,102, 51
1320 ,255,255, 0, 204,204, 0, 153,153, 0, 102,102, 0, 51, 51, 0};
1322 UChar_t green[46] = {204,255,204
1323 ,153,255,153, 153,204,153
1324 ,102,255,102, 102,204,102, 102,153,102
1325 , 51,255, 51, 51,204, 51, 51,153, 51, 51,102, 51
1326 , 0,255, 0, 0,204, 0, 0,153, 0, 0,102, 0, 0, 51, 0};
1328 UChar_t cyan[46] = {204,255,255
1329 ,153,255,255, 153,204,204
1330 ,102,255,255, 102,204,204, 102,153,153
1331 , 51,255,255, 51,204,204, 51,153,153, 51,102,102
1332 , 0,255,255, 0,204,204, 0,153,153, 0,102,102, 0, 51, 51};
1334 UChar_t blue[46] = {204,204,255
1335 ,153,153,255, 153,153,204
1336 ,102,102,255, 102,102,204, 102,102,153
1337 , 51, 51,255, 51, 51,204, 51, 51,153, 51, 51,102
1338 , 0, 0,255, 0, 0,204, 0, 0,153, 0, 0,102, 0, 0, 51};
1340 UChar_t pink[60] = {255, 51,153, 204, 0,102, 102, 0, 51, 153, 0, 51, 204, 51,102
1341 ,255,102,153, 255, 0,102, 255, 51,102, 204, 0, 51, 255, 0, 51
1342 ,255,153,204, 204,102,153, 153, 51,102, 153, 0,102, 204, 51,153
1343 ,255,102,204, 255, 0,153, 204, 0,153, 255, 51,204, 255, 0,153};
1345 UChar_t orange[60]={255,204,153, 204,153,102, 153,102, 51, 153,102, 0, 204,153, 51
1346 ,255,204,102, 255,153, 0, 255,204, 51, 204,153, 0, 255,204, 0
1347 ,255,153, 51, 204,102, 0, 102, 51, 0, 153, 51, 0, 204,102, 51
1348 ,255,153,102, 255,102, 0, 255,102, 51, 204, 51, 0, 255, 51, 0};
1350 UChar_t spring[60]={153,255, 51, 102,204, 0, 51,102, 0, 51,153, 0, 102,204, 51
1351 ,153,255,102, 102,255, 0, 102,255, 51, 51,204, 0, 51,255, 0
1352 ,204,255,153, 153,204,102, 102,153, 51, 102,153, 0, 153,204, 51
1353 ,204,255,102, 153,255, 0, 204,255, 51, 153,204, 0, 204,255, 0};
1355 UChar_t teal[60] = {153,255,204, 102,204,153, 51,153,102, 0,153,102, 51,204,153
1356 ,102,255,204, 0,255,102, 51,255,204, 0,204,153, 0,255,204
1357 , 51,255,153, 0,204,102, 0,102, 51, 0,153, 51, 51,204,102
1358 ,102,255,153, 0,255,153, 51,255,102, 0,204, 51, 0,255, 51};
1360 UChar_t azure[60] ={153,204,255, 102,153,204, 51,102,153, 0, 51,153, 51,102,204
1361 ,102,153,255, 0,102,255, 51,102,255, 0, 51,204, 0, 51,255
1362 , 51,153,255, 0,102,204, 0, 51,102, 0,102,153, 51,153,204
1363 ,102,204,255, 0,153,255, 51,204,255, 0,153,204, 0,204,255};
1365 UChar_t violet[60]={204,153,255, 153,102,204, 102, 51,153, 102, 0,153, 153, 51,204
1366 ,204,102,255, 153, 0,255, 204, 51,255, 153, 0,204, 204, 0,255
1367 ,153, 51,255, 102, 0,204, 51, 0,102, 51, 0,153, 102, 51,204
1368 ,153,102,255, 102, 0,255, 102, 51,255, 51, 0,204, 51, 0,255};
1370 TColor::CreateColorsCircle(kMagenta,
"kMagenta",magenta);
1371 TColor::CreateColorsCircle(kRed,
"kRed", red);
1372 TColor::CreateColorsCircle(kYellow,
"kYellow", yellow);
1373 TColor::CreateColorsCircle(kGreen,
"kGreen", green);
1374 TColor::CreateColorsCircle(kCyan,
"kCyan", cyan);
1375 TColor::CreateColorsCircle(kBlue,
"kBlue", blue);
1377 TColor::CreateColorsRectangle(kPink,
"kPink", pink);
1378 TColor::CreateColorsRectangle(kOrange,
"kOrange",orange);
1379 TColor::CreateColorsRectangle(kSpring,
"kSpring",spring);
1380 TColor::CreateColorsRectangle(kTeal,
"kTeal", teal);
1381 TColor::CreateColorsRectangle(kAzure,
"kAzure", azure);
1382 TColor::CreateColorsRectangle(kViolet,
"kViolet",violet);
1384 TColor::CreateColorsGray();
1390 Int_t TColor::GetColorPalette(Int_t i)
1392 Int_t ncolors = fgPalette.fN;
1393 if (ncolors == 0)
return 0;
1394 Int_t icol = i%ncolors;
1395 if (icol < 0) icol = 0;
1396 return fgPalette.fArray[icol];
1402 const TArrayI& TColor::GetPalette()
1410 Int_t TColor::GetNumberOfColors()
1412 return fgPalette.fN;
1420 Bool_t TColor::DefinedColors()
1424 Bool_t hasChanged = (gDefinedColors - gLastDefinedColors) > 50;
1425 gLastDefinedColors = gDefinedColors;
1434 ULong_t TColor::GetPixel()
const
1436 if (gVirtualX && !gROOT->IsBatch()) {
1438 TApplication::NeedGraphicsLibs();
1439 gApplication->InitializeGraphics();
1441 return gVirtualX->GetPixel(fNumber);
1451 void TColor::HLS2RGB(Float_t hue, Float_t light, Float_t satur,
1452 Float_t &r, Float_t &g, Float_t &b)
1455 Float_t rh, rl, rs, rm1, rm2;
1457 if (hue > 0) { rh = hue;
if (rh > 360) rh = 360; }
1458 if (light > 0) { rl = light;
if (rl > 1) rl = 1; }
1459 if (satur > 0) { rs = satur;
if (rs > 1) rs = 1; }
1462 rm2 = rl*(1.0 + rs);
1464 rm2 = rl + rs - rl*rs;
1467 if (!rs) { r = rl; g = rl; b = rl;
return; }
1468 r = HLStoRGB1(rm1, rm2, rh+120);
1469 g = HLStoRGB1(rm1, rm2, rh);
1470 b = HLStoRGB1(rm1, rm2, rh-120);
1476 Float_t TColor::HLStoRGB1(Float_t rn1, Float_t rn2, Float_t huei)
1479 if (hue > 360) hue = hue - 360;
1480 if (hue < 0) hue = hue + 360;
1481 if (hue < 60 )
return rn1 + (rn2-rn1)*hue/60;
1482 if (hue < 180)
return rn2;
1483 if (hue < 240)
return rn1 + (rn2-rn1)*(240-hue)/60;
1491 void TColor::HLS2RGB(Int_t h, Int_t l, Int_t s, Int_t &r, Int_t &g, Int_t &b)
1493 Float_t hh, ll, ss, rr, gg, bb;
1495 hh = Float_t(h) * 360 / 255;
1496 ll = Float_t(l) / 255;
1497 ss = Float_t(s) / 255;
1499 TColor::HLStoRGB(hh, ll, ss, rr, gg, bb);
1501 r = (Int_t) (rr * 255);
1502 g = (Int_t) (gg * 255);
1503 b = (Int_t) (bb * 255);
1517 void TColor::HSV2RGB(Float_t hue, Float_t satur, Float_t value,
1518 Float_t &r, Float_t &g, Float_t &b)
1530 i = (Int_t)floor(hue);
1532 p = value*(1-satur);
1533 q = value*(1-satur*f );
1534 t = value*(1-satur*(1-f));
1573 void TColor::ls(Option_t *)
const
1575 printf(
"Color:%d Red=%f Green=%f Blue=%f Alpha=%f Name=%s\n",
1576 fNumber, fRed, fGreen, fBlue, fAlpha, GetName());
1582 void TColor::Print(Option_t *)
const
1591 void TColor::RGB2HLS(Float_t rr, Float_t gg, Float_t bb,
1592 Float_t &hue, Float_t &light, Float_t &satur)
1594 Float_t rnorm, gnorm, bnorm, minval, maxval, msum, mdiff, r, g, b;
1595 minval = maxval =0 ;
1597 if (rr > 0) { r = rr;
if (r > 1) r = 1; }
1598 if (gg > 0) { g = gg;
if (g > 1) g = 1; }
1599 if (bb > 0) { b = bb;
if (b > 1) b = 1; }
1602 if (g < minval) minval = g;
1603 if (b < minval) minval = b;
1605 if (g > maxval) maxval = g;
1606 if (b > maxval) maxval = b;
1608 rnorm = gnorm = bnorm = 0;
1609 mdiff = maxval - minval;
1610 msum = maxval + minval;
1612 if (maxval != minval) {
1613 rnorm = (maxval - r)/mdiff;
1614 gnorm = (maxval - g)/mdiff;
1615 bnorm = (maxval - b)/mdiff;
1624 satur = mdiff/(2.0 - msum);
1627 hue = 60.0 * (6.0 + bnorm - gnorm);
1628 else if (g == maxval)
1629 hue = 60.0 * (2.0 + rnorm - bnorm);
1631 hue = 60.0 * (4.0 + gnorm - rnorm);
1649 void TColor::RGB2HSV(Float_t r, Float_t g, Float_t b,
1650 Float_t &hue, Float_t &satur, Float_t &value)
1652 Float_t min, max, delta;
1654 min = TMath::Min(TMath::Min(r, g), b);
1655 max = TMath::Max(TMath::Max(r, g), b);
1670 }
else if (g == max) {
1671 hue = 2+(b-r)/delta;
1673 hue = 4+(r-g)/delta;
1677 if (hue < 0) hue += 360;
1684 void TColor::RGB2HLS(Int_t r, Int_t g, Int_t b, Int_t &h, Int_t &l, Int_t &s)
1686 Float_t rr, gg, bb, hue, light, satur;
1688 rr = Float_t(r) / 255;
1689 gg = Float_t(g) / 255;
1690 bb = Float_t(b) / 255;
1692 TColor::RGBtoHLS(rr, gg, bb, hue, light, satur);
1694 h = (Int_t) (hue/360 * 255);
1695 l = (Int_t) (light * 255);
1696 s = (Int_t) (satur * 255);
1702 void TColor::SetRGB(Float_t r, Float_t g, Float_t b)
1704 TColor::InitializeColors();
1709 if (fRed < 0)
return;
1711 RGBtoHLS(r, g, b, fHue, fLight, fSaturation);
1714 if (gVirtualX) gVirtualX->GetPlanes(nplanes);
1715 if (nplanes == 0) nplanes = 16;
1723 if (fNumber > 50)
return;
1726 Float_t dr, dg, db, lr, lg, lb;
1729 HLStoRGB(fHue, 0.7*fLight, fSaturation, dr, dg, db);
1730 TColor *dark = gROOT->GetColor(100+fNumber);
1732 if (nplanes > 8) dark->SetRGB(dr, dg, db);
1733 else dark->SetRGB(0.3,0.3,0.3);
1737 HLStoRGB(fHue, 1.2*fLight, fSaturation, lr, lg, lb);
1738 TColor *light = gROOT->GetColor(150+fNumber);
1740 if (nplanes > 8) light->SetRGB(lr, lg, lb);
1741 else light->SetRGB(0.8,0.8,0.8);
1749 void TColor::Allocate()
1751 if (gVirtualX && !gROOT->IsBatch())
1753 gVirtualX->SetRGB(fNumber, GetRed(), GetGreen(), GetBlue());
1764 Int_t TColor::GetColor(
const char *hexcolor)
1766 if (hexcolor && *hexcolor ==
'#') {
1768 if (sscanf(hexcolor+1,
"%02x%02x%02x", &r, &g, &b) == 3)
1769 return GetColor(r, g, b);
1771 ::Error(
"TColor::GetColor(const char*)",
"incorrect color string");
1783 Int_t TColor::GetColor(Float_t r, Float_t g, Float_t b)
1786 rr = Int_t(r * 255);
1787 gg = Int_t(g * 255);
1788 bb = Int_t(b * 255);
1790 return GetColor(rr, gg, bb);
1798 Int_t TColor::GetColor(ULong_t pixel)
1802 Pixel2RGB(pixel, r, g, b);
1804 return GetColor(r, g, b);
1831 void TColor::SetColorThreshold(Float_t t)
1833 gColorThreshold = t;
1843 Int_t TColor::GetColor(Int_t r, Int_t g, Int_t b)
1845 TColor::InitializeColors();
1849 if (r > 255) r = 255;
1850 if (g > 255) g = 255;
1851 if (b > 255) b = 255;
1854 TObjArray *colors = (TObjArray*) gROOT->GetListOfColors();
1859 if ((color = (TColor*) colors->FindObject(Form(
"#%02x%02x%02x", r, g, b))))
1861 return color->GetNumber();
1864 rr = Float_t(r)/255.;
1865 gg = Float_t(g)/255.;
1866 bb = Float_t(b)/255.;
1871 if (gColorThreshold >= 0) {
1872 thres = gColorThreshold;
1876 if (gVirtualX) gVirtualX->GetPlanes(nplanes);
1877 if (nplanes >= 24) thres = 1.0/255.0;
1881 while ((color = (TColor*)next())) {
1882 if (TMath::Abs(color->GetRed() - rr) > thres)
continue;
1883 if (TMath::Abs(color->GetGreen() - gg) > thres)
continue;
1884 if (TMath::Abs(color->GetBlue() - bb) > thres)
continue;
1886 return color->GetNumber();
1892 color =
new TColor(colors->GetLast()+1, rr, gg, bb,
1893 Form(
"#%02x%02x%02x", r, g, b));
1895 return color->GetNumber();
1903 Int_t TColor::GetColorBright(Int_t n)
1905 if (n < 0)
return -1;
1908 TObjArray *colors = (TObjArray*) gROOT->GetListOfColors();
1909 Int_t ncolors = colors->GetSize();
1912 if (n < ncolors) color = (TColor*)colors->At(n);
1913 if (!color)
return -1;
1917 HLStoRGB(color->GetHue(), 1.2*color->GetLight(), color->GetSaturation(), r, g, b);
1922 if (nb < ncolors) colorb = (TColor*)colors->At(nb);
1923 if (colorb)
return nb;
1924 colorb =
new TColor(nb,r,g,b);
1925 colorb->SetName(Form(
"%s_bright",color->GetName()));
1926 colors->AddAtAndExpand(colorb,nb);
1935 Int_t TColor::GetColorDark(Int_t n)
1937 if (n < 0)
return -1;
1940 TObjArray *colors = (TObjArray*) gROOT->GetListOfColors();
1941 Int_t ncolors = colors->GetSize();
1944 if (n < ncolors) color = (TColor*)colors->At(n);
1945 if (!color)
return -1;
1949 HLStoRGB(color->GetHue(), 0.7*color->GetLight(), color->GetSaturation(), r, g, b);
1954 if (nd < ncolors) colord = (TColor*)colors->At(nd);
1955 if (colord)
return nd;
1956 colord =
new TColor(nd,r,g,b);
1957 colord->SetName(Form(
"%s_dark",color->GetName()));
1958 colors->AddAtAndExpand(colord,nd);
1966 Int_t TColor::GetColorTransparent(Int_t n, Float_t a)
1968 if (n < 0)
return -1;
1970 TColor *color = gROOT->GetColor(n);
1972 TColor *colort =
new TColor(gROOT->GetListOfColors()->GetLast()+1,
1973 color->GetRed(), color->GetGreen(), color->GetBlue());
1974 colort->SetAlpha(a);
1975 colort->SetName(Form(
"%s_transparent",color->GetName()));
1976 return colort->GetNumber();
1978 ::Error(
"TColor::GetColorTransparent",
"color with index %d not defined", n);
1992 Int_t TColor::GetFreeColorIndex()
1994 return gHighestColorIndex+1;
2003 ULong_t TColor::Number2Pixel(Int_t ci)
2005 TColor::InitializeColors();
2006 TColor *color = gROOT->GetColor(ci);
2008 return color->GetPixel();
2010 ::Warning(
"TColor::Number2Pixel",
"color with index %d not defined", ci);
2019 ULong_t TColor::RGB2Pixel(Float_t r, Float_t g, Float_t b)
2028 ColorStruct_t color;
2029 color.fRed = UShort_t(r * 65535);
2030 color.fGreen = UShort_t(g * 65535);
2031 color.fBlue = UShort_t(b * 65535);
2032 color.fMask = kDoRed | kDoGreen | kDoBlue;
2033 gVirtualX->AllocColor(gVirtualX->GetColormap(), color);
2034 return color.fPixel;
2041 ULong_t TColor::RGB2Pixel(Int_t r, Int_t g, Int_t b)
2046 if (r > 255) r = 255;
2047 if (g > 255) g = 255;
2048 if (b > 255) b = 255;
2050 ColorStruct_t color;
2051 color.fRed = UShort_t(r * 257);
2052 color.fGreen = UShort_t(g * 257);
2053 color.fBlue = UShort_t(b * 257);
2054 color.fMask = kDoRed | kDoGreen | kDoBlue;
2055 gVirtualX->AllocColor(gVirtualX->GetColormap(), color);
2056 return color.fPixel;
2064 void TColor::Pixel2RGB(ULong_t pixel, Float_t &r, Float_t &g, Float_t &b)
2066 ColorStruct_t color;
2067 color.fPixel = pixel;
2068 gVirtualX->QueryColor(gVirtualX->GetColormap(), color);
2069 r = (Float_t)color.fRed / 65535;
2070 g = (Float_t)color.fGreen / 65535;
2071 b = (Float_t)color.fBlue / 65535;
2079 void TColor::Pixel2RGB(ULong_t pixel, Int_t &r, Int_t &g, Int_t &b)
2081 ColorStruct_t color;
2082 color.fPixel = pixel;
2083 gVirtualX->QueryColor(gVirtualX->GetColormap(), color);
2084 r = color.fRed / 257;
2085 g = color.fGreen / 257;
2086 b = color.fBlue / 257;
2096 const char *TColor::PixelAsHexString(ULong_t pixel)
2098 static TString tempbuf;
2100 Pixel2RGB(pixel, r, g, b);
2101 tempbuf.Form(
"#%02x%02x%02x", r, g, b);
2108 void TColor::SaveColor(std::ostream &out, Int_t ci)
2115 TColor *c = gROOT->GetColor(ci);
2123 if (gROOT->ClassSaved(TColor::Class())) {
2127 out <<
" Int_t ci; // for color index setting" << std::endl;
2128 out <<
" TColor *color; // for color definition with alpha" << std::endl;
2132 out<<
" ci = "<<ci<<
";"<<std::endl;
2133 out<<
" color = new TColor(ci, "<<r<<
", "<<g<<
", "<<b<<
", "
2134 <<
"\" \", "<<a<<
");"<<std::endl;
2136 ri = (Int_t)(255*r);
2137 gi = (Int_t)(255*g);
2138 bi = (Int_t)(255*b);
2139 cname.Form(
"#%02x%02x%02x", ri, gi, bi);
2140 out<<
" ci = TColor::GetColor("<<quote<<cname.Data()<<quote<<
");"<<std::endl;
2146 Bool_t TColor::IsGrayscale()
2148 return fgGrayscaleMode;
2154 void TColor::SetGrayscale(Bool_t set )
2156 if (fgGrayscaleMode == set)
return;
2158 fgGrayscaleMode = set;
2160 if (!gVirtualX || gROOT->IsBatch())
return;
2162 TColor::InitializeColors();
2163 TIter iColor(gROOT->GetListOfColors());
2165 while ((color = (TColor*) iColor()))
2215 Int_t TColor::CreateGradientColorTable(UInt_t Number, Double_t* Stops,
2216 Double_t* Red, Double_t* Green,
2217 Double_t* Blue, UInt_t NColors, Float_t alpha)
2219 TColor::InitializeColors();
2222 UInt_t nPalette = 0;
2223 Int_t *palette =
new Int_t[NColors+1];
2224 UInt_t nColorsGradient;
2226 if(Number < 2 || NColors < 1){
2233 for (c = 0; c < Number; c++) {
2234 if (Red[c] < 0 || Red[c] > 1.0 ||
2235 Green[c] < 0 || Green[c] > 1.0 ||
2236 Blue[c] < 0 || Blue[c] > 1.0 ||
2237 Stops[c] < 0 || Stops[c] > 1.0) {
2242 if (Stops[c-1] > Stops[c]) {
2252 for (g = 1; g < Number; g++) {
2254 nColorsGradient = (Int_t) (floor(NColors*Stops[g]) - floor(NColors*Stops[g-1]));
2255 for (c = 0; c < nColorsGradient; c++) {
2256 new TColor( Float_t(Red[g-1] + c * (Red[g] - Red[g-1]) / nColorsGradient),
2257 Float_t(Green[g-1] + c * (Green[g] - Green[g-1])/ nColorsGradient),
2258 Float_t(Blue[g-1] + c * (Blue[g] - Blue[g-1]) / nColorsGradient),
2260 palette[nPalette] = gHighestColorIndex;
2265 TColor::SetPalette(nPalette, palette);
2267 return gHighestColorIndex + 1 - NColors;
2404 void TColor::SetPalette(Int_t ncolors, Int_t *colors, Float_t alpha)
2408 static Int_t paletteType = 0;
2410 Int_t palette[50] = {19,18,17,16,15,14,13,12,11,20,
2411 21,22,23,24,25,26,27,28,29,30, 8,
2412 31,32,33,34,35,36,37,38,39,40, 9,
2413 41,42,43,44,45,47,48,49,46,50, 2,
2414 7, 6, 5, 4, 3, 2,1};
2419 fgPalette.Set(ncolors);
2420 for (i=0;i<ncolors;i++) fgPalette.fArray[i] = palette[i];
2426 if (ncolors == 1 && colors == 0) {
2428 fgPalette.Set(ncolors);
2429 for (i=0;i<ncolors-1;i++) fgPalette.fArray[i] = 51+i;
2430 fgPalette.fArray[ncolors-1] = kRed;
2436 if (colors == 0 && ncolors>50) {
2438 if (!fgPalettesList.fN) fgPalettesList.Set(63);
2439 Int_t Idx = (Int_t)fgPalettesList.fArray[ncolors-51];
2443 Double_t alphas = 10*(fgPalettesList.fArray[ncolors-51]-Idx);
2444 Bool_t same_alpha = TMath::Abs(alpha-alphas) < 0.0001;
2445 if (paletteType == ncolors && same_alpha)
return;
2447 for (i=0;i<255;i++) fgPalette.fArray[i] = Idx+i;
2448 paletteType = ncolors;
2451 if (alphas>0 && !same_alpha) {
2453 for (i=0;i<255;i++) {
2454 ca = gROOT->GetColor(Idx+i);
2455 ca->SetAlpha(alpha);
2457 fgPalettesList.fArray[paletteType-51] = (Double_t)Idx+alpha/10.;
2462 TColor::InitializeColors();
2463 Double_t stops[9] = { 0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000};
2469 Double_t red[9] = { 0./255., 9./255., 13./255., 17./255., 24./255., 32./255., 27./255., 25./255., 29./255.};
2470 Double_t green[9] = { 0./255., 0./255., 0./255., 2./255., 37./255., 74./255., 113./255., 160./255., 221./255.};
2471 Double_t blue[9] = { 28./255., 42./255., 59./255., 78./255., 98./255., 129./255., 154./255., 184./255., 221./255.};
2472 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2479 Double_t red[9] = { 0./255., 32./255., 64./255., 96./255., 128./255., 160./255., 192./255., 224./255., 255./255.};
2480 Double_t green[9] = { 0./255., 32./255., 64./255., 96./255., 128./255., 160./255., 192./255., 224./255., 255./255.};
2481 Double_t blue[9] = { 0./255., 32./255., 64./255., 96./255., 128./255., 160./255., 192./255., 224./255., 255./255.};
2482 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2489 Double_t red[9] = { 0./255., 45./255., 99./255., 156./255., 212./255., 230./255., 237./255., 234./255., 242./255.};
2490 Double_t green[9] = { 0./255., 0./255., 0./255., 45./255., 101./255., 168./255., 238./255., 238./255., 243./255.};
2491 Double_t blue[9] = { 0./255., 1./255., 1./255., 3./255., 9./255., 8./255., 11./255., 95./255., 230./255.};
2492 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2499 Double_t red[9] = { 0./255., 22./255., 44./255., 68./255., 93./255., 124./255., 160./255., 192./255., 237./255.};
2500 Double_t green[9] = { 0./255., 16./255., 41./255., 67./255., 93./255., 125./255., 162./255., 194./255., 241./255.};
2501 Double_t blue[9] = { 97./255., 100./255., 99./255., 99./255., 93./255., 68./255., 44./255., 26./255., 74./255.};
2502 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2509 Double_t red[9] = { 0./255., 5./255., 15./255., 35./255., 102./255., 196./255., 208./255., 199./255., 110./255.};
2510 Double_t green[9] = { 0./255., 48./255., 124./255., 192./255., 206./255., 226./255., 97./255., 16./255., 0./255.};
2511 Double_t blue[9] = { 99./255., 142./255., 198./255., 201./255., 90./255., 22./255., 13./255., 8./255., 2./255.};
2512 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2519 Double_t red[9] = { 242./255., 234./255., 237./255., 230./255., 212./255., 156./255., 99./255., 45./255., 0./255.};
2520 Double_t green[9] = { 243./255., 238./255., 238./255., 168./255., 101./255., 45./255., 0./255., 0./255., 0./255.};
2521 Double_t blue[9] = { 230./255., 95./255., 11./255., 8./255., 9./255., 3./255., 1./255., 1./255., 0./255.};
2522 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2529 Double_t red[9] = { 0.2082, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764};
2530 Double_t green[9] = { 0.1664, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832};
2531 Double_t blue[9] = { 0.5293, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539};
2532 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2539 Double_t red[9] = { 0.0000, 0.0956, 0.0098, 0.2124, 0.6905, 0.9242, 0.7914, 0.7596, 1.0000};
2540 Double_t green[9] = { 0.0000, 0.1147, 0.3616, 0.5041, 0.4577, 0.4691, 0.6905, 0.9237, 1.0000};
2541 Double_t blue[9] = { 0.0000, 0.2669, 0.3121, 0.1318, 0.2236, 0.6741, 0.9882, 0.9593, 1.0000};
2542 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2549 Double_t red[9] = {13./255., 23./255., 25./255., 63./255., 76./255., 104./255., 137./255., 161./255., 206./255.};
2550 Double_t green[9] = {95./255., 67./255., 37./255., 21./255., 0./255., 12./255., 35./255., 52./255., 79./255.};
2551 Double_t blue[9] = { 4./255., 3./255., 2./255., 6./255., 11./255., 22./255., 49./255., 98./255., 208./255.};
2552 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2559 Double_t red[9] = {0./255., 61./255., 89./255., 122./255., 143./255., 160./255., 185./255., 204./255., 231./255.};
2560 Double_t green[9] = {0./255., 0./255., 0./255., 0./255., 14./255., 37./255., 72./255., 132./255., 235./255.};
2561 Double_t blue[9] = {0./255., 140./255., 224./255., 144./255., 4./255., 5./255., 6./255., 9./255., 13./255.};
2562 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2569 Double_t red[9] = { 14./255., 7./255., 2./255., 0./255., 5./255., 11./255., 55./255., 131./255., 229./255.};
2570 Double_t green[9] = {105./255., 56./255., 26./255., 1./255., 42./255., 74./255., 131./255., 171./255., 229./255.};
2571 Double_t blue[9] = { 2./255., 21./255., 35./255., 60./255., 92./255., 113./255., 160./255., 185./255., 229./255.};
2572 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2579 Double_t red[9] = { 0./255., 0./255., 0./255., 70./255., 148./255., 231./255., 235./255., 237./255., 244./255.};
2580 Double_t green[9] = { 0./255., 0./255., 0./255., 0./255., 0./255., 69./255., 67./255., 216./255., 244./255.};
2581 Double_t blue[9] = { 0./255., 102./255., 228./255., 231./255., 177./255., 124./255., 137./255., 20./255., 244./255.};
2582 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2589 Double_t red[9] = { 50./255., 56./255., 63./255., 68./255., 93./255., 121./255., 165./255., 192./255., 241./255.};
2590 Double_t green[9] = { 66./255., 81./255., 91./255., 96./255., 111./255., 128./255., 155./255., 189./255., 241./255.};
2591 Double_t blue[9] = { 97./255., 91./255., 75./255., 65./255., 77./255., 103./255., 143./255., 167./255., 217./255.};
2592 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2599 Double_t red[9] = { 145./255., 166./255., 167./255., 156./255., 131./255., 114./255., 101./255., 112./255., 132./255.};
2600 Double_t green[9] = { 158./255., 178./255., 179./255., 181./255., 163./255., 154./255., 144./255., 152./255., 159./255.};
2601 Double_t blue[9] = { 190./255., 199./255., 201./255., 192./255., 176./255., 169./255., 160./255., 166./255., 190./255.};
2602 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2609 Double_t red[9] = { 93./255., 91./255., 99./255., 108./255., 130./255., 125./255., 132./255., 155./255., 174./255.};
2610 Double_t green[9] = { 126./255., 124./255., 128./255., 129./255., 131./255., 121./255., 119./255., 153./255., 173./255.};
2611 Double_t blue[9] = { 103./255., 94./255., 87./255., 85./255., 80./255., 85./255., 107./255., 120./255., 146./255.};
2612 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2619 Double_t red[9] = { 24./255., 40./255., 69./255., 90./255., 104./255., 114./255., 120./255., 132./255., 103./255.};
2620 Double_t green[9] = { 29./255., 52./255., 94./255., 127./255., 150./255., 162./255., 159./255., 151./255., 101./255.};
2621 Double_t blue[9] = { 29./255., 52./255., 96./255., 132./255., 162./255., 181./255., 184./255., 186./255., 131./255.};
2622 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2629 Double_t red[9] = { 46./255., 38./255., 61./255., 92./255., 113./255., 121./255., 132./255., 150./255., 191./255.};
2630 Double_t green[9] = { 46./255., 36./255., 40./255., 69./255., 110./255., 135./255., 131./255., 92./255., 34./255.};
2631 Double_t blue[9] = { 46./255., 80./255., 74./255., 70./255., 81./255., 105./255., 165./255., 211./255., 225./255.};
2632 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2639 Double_t red[9] = { 0./255., 4./255., 12./255., 30./255., 52./255., 101./255., 142./255., 190./255., 237./255.};
2640 Double_t green[9] = { 0./255., 40./255., 86./255., 121./255., 140./255., 172./255., 187./255., 213./255., 240./255.};
2641 Double_t blue[9] = { 0./255., 9./255., 14./255., 18./255., 21./255., 23./255., 27./255., 35./255., 101./255.};
2642 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2649 Double_t red[9] = { 198./255., 206./255., 206./255., 211./255., 198./255., 181./255., 161./255., 171./255., 244./255.};
2650 Double_t green[9] = { 103./255., 133./255., 150./255., 172./255., 178./255., 174./255., 163./255., 175./255., 244./255.};
2651 Double_t blue[9] = { 49./255., 54./255., 55./255., 66./255., 91./255., 130./255., 184./255., 224./255., 244./255.};
2652 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2659 Double_t red[9] = { 243./255., 243./255., 240./255., 240./255., 241./255., 239./255., 186./255., 151./255., 129./255.};
2660 Double_t green[9] = { 0./255., 46./255., 99./255., 149./255., 194./255., 220./255., 183./255., 166./255., 147./255.};
2661 Double_t blue[9] = { 6./255., 8./255., 36./255., 91./255., 169./255., 235./255., 246./255., 240./255., 233./255.};
2662 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2669 Double_t red[9] = { 22./255., 19./255., 19./255., 25./255., 35./255., 53./255., 88./255., 139./255., 210./255.};
2670 Double_t green[9] = { 0./255., 32./255., 69./255., 108./255., 135./255., 159./255., 183./255., 198./255., 215./255.};
2671 Double_t blue[9] = { 77./255., 96./255., 110./255., 116./255., 110./255., 100./255., 90./255., 78./255., 70./255.};
2672 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2679 Double_t red[9] = { 68./255., 116./255., 165./255., 182./255., 189./255., 180./255., 145./255., 111./255., 71./255.};
2680 Double_t green[9] = { 37./255., 82./255., 135./255., 178./255., 204./255., 225./255., 221./255., 202./255., 147./255.};
2681 Double_t blue[9] = { 16./255., 55./255., 105./255., 147./255., 196./255., 226./255., 232./255., 224./255., 178./255.};
2682 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2689 Double_t red[9] = { 61./255., 99./255., 136./255., 181./255., 213./255., 225./255., 198./255., 136./255., 24./255.};
2690 Double_t green[9] = { 149./255., 140./255., 96./255., 83./255., 132./255., 178./255., 190./255., 135./255., 22./255.};
2691 Double_t blue[9] = { 214./255., 203./255., 168./255., 135./255., 110./255., 100./255., 111./255., 113./255., 22./255.};
2692 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2699 Double_t red[9] = { 76./255., 120./255., 156./255., 183./255., 197./255., 180./255., 162./255., 154./255., 140./255.};
2700 Double_t green[9] = { 34./255., 35./255., 42./255., 69./255., 102./255., 137./255., 164./255., 188./255., 197./255.};
2701 Double_t blue[9] = { 64./255., 69./255., 78./255., 105./255., 142./255., 177./255., 205./255., 217./255., 198./255.};
2702 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2709 Double_t red[9] = { 37./255., 102./255., 157./255., 188./255., 196./255., 214./255., 223./255., 235./255., 251./255.};
2710 Double_t green[9] = { 37./255., 29./255., 25./255., 37./255., 67./255., 91./255., 132./255., 185./255., 251./255.};
2711 Double_t blue[9] = { 37./255., 32./255., 33./255., 45./255., 66./255., 98./255., 137./255., 187./255., 251./255.};
2712 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2719 Double_t red[9] = { 79./255., 100./255., 119./255., 137./255., 153./255., 172./255., 192./255., 205./255., 250./255.};
2720 Double_t green[9] = { 63./255., 79./255., 93./255., 103./255., 115./255., 135./255., 167./255., 196./255., 250./255.};
2721 Double_t blue[9] = { 51./255., 59./255., 66./255., 61./255., 62./255., 70./255., 110./255., 160./255., 250./255.};
2722 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2729 Double_t red[9] = { 43./255., 44./255., 50./255., 66./255., 125./255., 172./255., 178./255., 155./255., 157./255.};
2730 Double_t green[9] = { 63./255., 63./255., 85./255., 101./255., 138./255., 163./255., 122./255., 51./255., 39./255.};
2731 Double_t blue[9] = { 121./255., 101./255., 58./255., 44./255., 47./255., 55./255., 57./255., 44./255., 43./255.};
2732 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2739 Double_t red[9] = { 0./255., 41./255., 62./255., 79./255., 90./255., 87./255., 99./255., 140./255., 228./255.};
2740 Double_t green[9] = { 0./255., 57./255., 81./255., 93./255., 85./255., 70./255., 71./255., 125./255., 228./255.};
2741 Double_t blue[9] = { 95./255., 91./255., 91./255., 82./255., 60./255., 43./255., 44./255., 112./255., 228./255.};
2742 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2749 Double_t red[9] = { 49./255., 59./255., 72./255., 88./255., 114./255., 141./255., 176./255., 205./255., 222./255.};
2750 Double_t green[9] = { 78./255., 72./255., 66./255., 57./255., 59./255., 75./255., 106./255., 142./255., 173./255.};
2751 Double_t blue[9] = { 78./255., 55./255., 46./255., 40./255., 39./255., 39./255., 40./255., 41./255., 47./255.};
2752 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2759 Double_t red[9] = { 243./255., 222./255., 201./255., 185./255., 165./255., 158./255., 166./255., 187./255., 219./255.};
2760 Double_t green[9] = { 94./255., 108./255., 132./255., 135./255., 125./255., 96./255., 68./255., 51./255., 61./255.};
2761 Double_t blue[9] = { 7./255., 9./255., 12./255., 19./255., 45./255., 89./255., 118./255., 146./255., 118./255.};
2762 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2769 Double_t red[9] = { 19./255., 44./255., 74./255., 105./255., 137./255., 166./255., 194./255., 206./255., 220./255.};
2770 Double_t green[9] = { 19./255., 28./255., 40./255., 55./255., 82./255., 110./255., 159./255., 181./255., 220./255.};
2771 Double_t blue[9] = { 19./255., 42./255., 68./255., 96./255., 129./255., 157./255., 188./255., 203./255., 220./255.};
2772 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2779 Double_t red[9] = { 33./255., 44./255., 70./255., 99./255., 140./255., 165./255., 199./255., 211./255., 216./255.};
2780 Double_t green[9] = { 38./255., 50./255., 76./255., 105./255., 140./255., 165./255., 191./255., 189./255., 167./255.};
2781 Double_t blue[9] = { 55./255., 67./255., 97./255., 124./255., 140./255., 166./255., 163./255., 129./255., 52./255.};
2782 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2789 Double_t red[9] = { 0./255., 33./255., 73./255., 124./255., 136./255., 152./255., 159./255., 171./255., 223./255.};
2790 Double_t green[9] = { 0./255., 43./255., 92./255., 124./255., 134./255., 126./255., 121./255., 144./255., 223./255.};
2791 Double_t blue[9] = { 0./255., 43./255., 68./255., 76./255., 73./255., 64./255., 72./255., 114./255., 223./255.};
2792 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2799 Double_t red[9] = { 5./255., 18./255., 45./255., 124./255., 193./255., 223./255., 205./255., 128./255., 49./255.};
2800 Double_t green[9] = { 48./255., 134./255., 207./255., 230./255., 193./255., 113./255., 28./255., 0./255., 7./255.};
2801 Double_t blue[9] = { 6./255., 15./255., 41./255., 121./255., 193./255., 226./255., 208./255., 130./255., 49./255.};
2802 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2809 Double_t red[9] = { 180./255., 106./255., 104./255., 135./255., 164./255., 188./255., 189./255., 165./255., 144./255.};
2810 Double_t green[9] = { 72./255., 126./255., 154./255., 184./255., 198./255., 207./255., 205./255., 190./255., 179./255.};
2811 Double_t blue[9] = { 41./255., 120./255., 158./255., 188./255., 194./255., 181./255., 145./255., 100./255., 62./255.};
2812 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2819 Double_t red[9] = { 57./255., 72./255., 94./255., 117./255., 136./255., 154./255., 174./255., 192./255., 215./255.};
2820 Double_t green[9] = { 0./255., 33./255., 68./255., 109./255., 140./255., 171./255., 192./255., 196./255., 209./255.};
2821 Double_t blue[9] = { 116./255., 137./255., 173./255., 201./255., 200./255., 201./255., 203./255., 190./255., 187./255.};
2822 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2829 Double_t red[9] = { 31./255., 71./255., 123./255., 160./255., 210./255., 222./255., 214./255., 199./255., 183./255.};
2830 Double_t green[9] = { 40./255., 117./255., 171./255., 211./255., 231./255., 220./255., 190./255., 132./255., 65./255.};
2831 Double_t blue[9] = { 234./255., 214./255., 228./255., 222./255., 210./255., 160./255., 105./255., 60./255., 34./255.};
2832 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2839 Double_t red[9] = { 123./255., 108./255., 109./255., 126./255., 154./255., 172./255., 188./255., 196./255., 218./255.};
2840 Double_t green[9] = { 184./255., 138./255., 130./255., 133./255., 154./255., 175./255., 188./255., 196./255., 218./255.};
2841 Double_t blue[9] = { 208./255., 130./255., 109./255., 99./255., 110./255., 122./255., 150./255., 171./255., 218./255.};
2842 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2849 Double_t red[9] = { 105./255., 106./255., 122./255., 143./255., 159./255., 172./255., 176./255., 181./255., 207./255.};
2850 Double_t green[9] = { 252./255., 197./255., 194./255., 187./255., 174./255., 162./255., 153./255., 136./255., 125./255.};
2851 Double_t blue[9] = { 146./255., 133./255., 144./255., 155./255., 163./255., 167./255., 166./255., 162./255., 174./255.};
2852 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2859 Double_t red[9] = { 171./255., 141./255., 145./255., 152./255., 154./255., 159./255., 163./255., 158./255., 177./255.};
2860 Double_t green[9] = { 236./255., 143./255., 100./255., 63./255., 53./255., 55./255., 44./255., 31./255., 6./255.};
2861 Double_t blue[9] = { 59./255., 48./255., 46./255., 44./255., 42./255., 54./255., 82./255., 112./255., 179./255.};
2862 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2869 Double_t red[9] = { 180./255., 190./255., 209./255., 223./255., 204./255., 228./255., 205./255., 152./255., 91./255.};
2870 Double_t green[9] = { 93./255., 125./255., 147./255., 172./255., 181./255., 224./255., 233./255., 198./255., 158./255.};
2871 Double_t blue[9] = { 236./255., 218./255., 160./255., 133./255., 114./255., 132./255., 162./255., 220./255., 218./255.};
2872 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2879 Double_t red[9] = { 225./255., 183./255., 162./255., 135./255., 115./255., 111./255., 119./255., 145./255., 211./255.};
2880 Double_t green[9] = { 205./255., 177./255., 166./255., 135./255., 124./255., 117./255., 117./255., 132./255., 172./255.};
2881 Double_t blue[9] = { 186./255., 165./255., 155./255., 135./255., 126./255., 130./255., 150./255., 178./255., 226./255.};
2882 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2889 Double_t red[9] = { 39./255., 43./255., 59./255., 63./255., 80./255., 116./255., 153./255., 177./255., 223./255.};
2890 Double_t green[9] = { 39./255., 43./255., 59./255., 74./255., 91./255., 114./255., 139./255., 165./255., 223./255.};
2891 Double_t blue[9] = { 39./255., 50./255., 59./255., 70./255., 85./255., 115./255., 151./255., 176./255., 223./255.};
2892 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2899 Double_t red[9] = { 0./255., 38./255., 60./255., 76./255., 84./255., 89./255., 101./255., 128./255., 204./255.};
2900 Double_t green[9] = { 0./255., 10./255., 15./255., 23./255., 35./255., 57./255., 83./255., 123./255., 199./255.};
2901 Double_t blue[9] = { 0./255., 11./255., 22./255., 40./255., 63./255., 86./255., 97./255., 94./255., 85./255.};
2902 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2909 Double_t red[9] = { 94./255., 112./255., 141./255., 165./255., 167./255., 140./255., 91./255., 49./255., 27./255.};
2910 Double_t green[9] = { 27./255., 46./255., 88./255., 135./255., 166./255., 161./255., 135./255., 97./255., 58./255.};
2911 Double_t blue[9] = { 42./255., 52./255., 81./255., 106./255., 139./255., 158./255., 155./255., 137./255., 116./255.};
2912 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2919 Double_t red[9] = { 30./255., 49./255., 79./255., 117./255., 135./255., 151./255., 146./255., 138./255., 147./255.};
2920 Double_t green[9] = { 63./255., 60./255., 72./255., 90./255., 94./255., 94./255., 68./255., 46./255., 16./255.};
2921 Double_t blue[9] = { 18./255., 28./255., 41./255., 56./255., 62./255., 63./255., 50./255., 36./255., 21./255.};
2922 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2929 Double_t red[9] = { 0./255., 30./255., 63./255., 101./255., 143./255., 152./255., 169./255., 187./255., 230./255.};
2930 Double_t green[9] = { 0./255., 14./255., 28./255., 42./255., 58./255., 61./255., 67./255., 74./255., 91./255.};
2931 Double_t blue[9] = { 39./255., 26./255., 21./255., 18./255., 15./255., 14./255., 14./255., 13./255., 13./255.};
2932 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2939 Double_t red[9] = { 149./255., 140./255., 164./255., 179./255., 182./255., 181./255., 131./255., 87./255., 61./255.};
2940 Double_t green[9] = { 62./255., 70./255., 107./255., 136./255., 144./255., 138./255., 117./255., 87./255., 74./255.};
2941 Double_t blue[9] = { 40./255., 38./255., 45./255., 49./255., 49./255., 49./255., 38./255., 32./255., 34./255.};
2942 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2949 Double_t red[9] = { 99./255., 112./255., 148./255., 165./255., 179./255., 182./255., 183./255., 183./255., 208./255.};
2950 Double_t green[9] = { 39./255., 40./255., 57./255., 79./255., 104./255., 127./255., 148./255., 161./255., 198./255.};
2951 Double_t blue[9] = { 15./255., 16./255., 18./255., 33./255., 51./255., 79./255., 103./255., 129./255., 177./255.};
2952 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2959 Double_t red[9] = { 99./255., 116./255., 154./255., 174./255., 200./255., 196./255., 201./255., 201./255., 230./255.};
2960 Double_t green[9] = { 0./255., 0./255., 8./255., 32./255., 58./255., 83./255., 119./255., 136./255., 173./255.};
2961 Double_t blue[9] = { 5./255., 6./255., 7./255., 9./255., 9./255., 14./255., 17./255., 19./255., 24./255.};
2962 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2969 Double_t red[9] = { 82./255., 106./255., 126./255., 141./255., 155./255., 163./255., 142./255., 107./255., 66./255.};
2970 Double_t green[9] = { 62./255., 44./255., 69./255., 107./255., 135./255., 152./255., 149./255., 132./255., 119./255.};
2971 Double_t blue[9] = { 39./255., 25./255., 31./255., 60./255., 73./255., 68./255., 49./255., 72./255., 188./255.};
2972 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2979 Double_t red[9] = { 18./255., 29./255., 44./255., 72./255., 116./255., 158./255., 184./255., 208./255., 221./255.};
2980 Double_t green[9] = { 27./255., 46./255., 71./255., 105./255., 146./255., 177./255., 189./255., 190./255., 183./255.};
2981 Double_t blue[9] = { 39./255., 55./255., 80./255., 108./255., 130./255., 133./255., 124./255., 100./255., 76./255.};
2982 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2989 Double_t red[9] = { 0./255., 48./255., 119./255., 173./255., 212./255., 224./255., 228./255., 228./255., 245./255.};
2990 Double_t green[9] = { 0./255., 13./255., 30./255., 47./255., 79./255., 127./255., 167./255., 205./255., 245./255.};
2991 Double_t blue[9] = { 0./255., 68./255., 75./255., 43./255., 16./255., 22./255., 55./255., 128./255., 245./255.};
2992 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
2999 Double_t red[9] = { 34./255., 70./255., 129./255., 187./255., 225./255., 226./255., 216./255., 193./255., 179./255.};
3000 Double_t green[9] = { 48./255., 91./255., 147./255., 194./255., 226./255., 229./255., 196./255., 110./255., 12./255.};
3001 Double_t blue[9] = { 234./255., 212./255., 216./255., 224./255., 206./255., 110./255., 53./255., 40./255., 29./255.};
3002 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3009 Double_t red[9] = { 30./255., 55./255., 103./255., 147./255., 174./255., 203./255., 188./255., 151./255., 105./255.};
3010 Double_t green[9] = { 0./255., 65./255., 138./255., 182./255., 187./255., 175./255., 121./255., 53./255., 9./255.};
3011 Double_t blue[9] = { 191./255., 202./255., 212./255., 208./255., 171./255., 140./255., 97./255., 57./255., 30./255.};
3012 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3019 Double_t red[9] = { 112./255., 97./255., 113./255., 125./255., 138./255., 159./255., 178./255., 188./255., 225./255.};
3020 Double_t green[9] = { 16./255., 17./255., 24./255., 37./255., 56./255., 81./255., 110./255., 136./255., 189./255.};
3021 Double_t blue[9] = { 38./255., 35./255., 46./255., 59./255., 78./255., 103./255., 130./255., 152./255., 201./255.};
3022 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3029 Double_t red[9] = { 18./255., 72./255., 5./255., 23./255., 29./255., 201./255., 200./255., 98./255., 29./255.};
3030 Double_t green[9] = { 0./255., 0./255., 43./255., 167./255., 211./255., 117./255., 0./255., 0./255., 0./255.};
3031 Double_t blue[9] = { 51./255., 203./255., 177./255., 26./255., 10./255., 9./255., 8./255., 3./255., 0./255.};
3032 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3039 Double_t red[9] = { 19./255., 42./255., 64./255., 88./255., 118./255., 147./255., 175./255., 187./255., 205./255.};
3040 Double_t green[9] = { 19./255., 55./255., 89./255., 125./255., 154./255., 169./255., 161./255., 129./255., 70./255.};
3041 Double_t blue[9] = { 19./255., 32./255., 47./255., 70./255., 100./255., 128./255., 145./255., 130./255., 75./255.};
3042 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3049 Double_t red[9] = { 33./255., 31./255., 42./255., 68./255., 86./255., 111./255., 141./255., 172./255., 227./255.};
3050 Double_t green[9] = { 255./255., 175./255., 145./255., 106./255., 88./255., 55./255., 15./255., 0./255., 0./255.};
3051 Double_t blue[9] = { 255./255., 205./255., 202./255., 203./255., 208./255., 205./255., 203./255., 206./255., 231./255.};
3052 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3059 Double_t red[9] = { 0./255., 25./255., 50./255., 79./255., 110./255., 145./255., 181./255., 201./255., 254./255.};
3060 Double_t green[9] = { 0./255., 16./255., 30./255., 46./255., 63./255., 82./255., 101./255., 124./255., 179./255.};
3061 Double_t blue[9] = { 0./255., 12./255., 21./255., 29./255., 39./255., 49./255., 61./255., 74./255., 103./255.};
3062 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3069 Double_t red[9] = { 0./255., 13./255., 30./255., 44./255., 72./255., 120./255., 156./255., 200./255., 247./255.};
3070 Double_t green[9] = { 0./255., 36./255., 84./255., 117./255., 141./255., 153./255., 151./255., 158./255., 247./255.};
3071 Double_t blue[9] = { 0./255., 94./255., 100./255., 82./255., 56./255., 66./255., 76./255., 131./255., 247./255.};
3072 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3079 Double_t red[9] = { 26./255., 51./255., 43./255., 33./255., 28./255., 35./255., 74./255., 144./255., 246./255.};
3080 Double_t green[9] = { 9./255., 24./255., 55./255., 87./255., 118./255., 150./255., 180./255., 200./255., 222./255.};
3081 Double_t blue[9] = { 30./255., 96./255., 112./255., 114./255., 112./255., 101./255., 72./255., 35./255., 0./255.};
3082 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3089 Double_t red[9] = { 0./255., 5./255., 65./255., 97./255., 124./255., 156./255., 189./255., 224./255., 255./255.};
3090 Double_t green[9] = { 32./255., 54./255., 77./255., 100./255., 123./255., 148./255., 175./255., 203./255., 234./255.};
3091 Double_t blue[9] = { 77./255., 110./255., 107./255., 111./255., 120./255., 119./255., 111./255., 94./255., 70./255.};
3092 Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
3097 ::Error(
"SetPalette",
"Unknown palette number %d", ncolors);
3100 paletteType = ncolors;
3101 if (Idx>0) fgPalettesList.fArray[paletteType-51] = (Double_t)Idx;
3102 else fgPalettesList.fArray[paletteType-51] = 0.;
3103 if (alpha > 0.) fgPalettesList.fArray[paletteType-51] += alpha/10.;
3109 fgPalette.Set(ncolors);
3110 for (i=0;i<ncolors;i++) fgPalette.fArray[i] = colors[i];
3112 fgPalette.Set(TMath::Min(50,ncolors));
3113 for (i=0;i<TMath::Min(50,ncolors);i++) fgPalette.fArray[i] = palette[i];
3123 void TColor::InvertPalette()
3125 std::reverse(fgPalette.fArray, fgPalette.fArray + fgPalette.GetSize());