At initialization time, a table of colors is generated. An existing color can
be retrieved by its index:
TColor *color = gROOT->GetColor(10);
color->SetRGB(0.1, 0.2, 0.3);
Int_t ci = 1756; // color index TColor *color = new TColor(ci, 0.1, 0.2, 0.3);
Two sets of colors are initialized;
Using this color set for your text, background or graphics will give your application a consistent appearance across different platforms and browsers.
Colors are grouped by hue, the aspect most important in human perception. Touching color chips have the same hue, but with different brightness and vividness.
Colors of slightly different hues clash. If you intend to display colors of the same hue together, you should pick them from the same group.
Each color chip is identified by a mnemonic (e.g. kYellow) and a number. The keywords, kRed, kBlue, kYellow, kPink, etc are defined in the header file Rtypes.h that is included in all ROOT other header files. It is better to use these keywords in user code instead of hardcoded color numbers, e.g.:
myObject.SetFillColor(kRed); myObject.SetFillColor(kYellow-10); myLine.SetLineColor(kMagenta+2);
{ TColorWheel *w = new TColorWheel(); w->Draw(); return w->GetCanvas(); }
Int_t dark = TColor::GetColorDark(color_index); Int_t bright = TColor::GetColorBright(color_index);
{ TColorWheel *w = new TColorWheel(); w->Draw(); w->GetCanvas()->SetGrayscale(); w->GetCanvas()->Modified(); w->GetCanvas()->Update(); return w->GetCanvas(); }
gStyle->SetPalette(...);
This function has two parameters: the number of colors in the palette and an array of containing the indices of colors in the palette. The following small example demonstrates how to define and use the color palette:
To define more a complex palette with a continuous gradient of color, one should use the static function TColor::CreateGradientColorTable(). The following example demonstrates how to proceed:
{ TCanvas *c2 = new TCanvas("c2","c2",0,0,600,400); TF2 *f2 = new TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3); const Int_t Number = 3; Double_t Red[Number] = { 1.00, 0.00, 0.00}; Double_t Green[Number] = { 0.00, 1.00, 0.00}; Double_t Blue[Number] = { 1.00, 0.00, 1.00}; Double_t Length[Number] = { 0.00, 0.50, 1.00 }; Int_t nb=50; TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb); f2->SetContour(nb); f2->SetLineWidth(1); f2->SetLineColor(kBlack); f2->Draw("surf1z"); return c2; }
The function TColor::CreateGradientColorTable() automatically calls gStyle->SetPalette(), so there is not need to add one.
After a call to TColor::CreateGradientColorTable() it is sometimes
useful to store the newly create palette for further use. In particular, it is
recommended to do if one wants to switch between several user define palettes.
To store a palette in an array it is enough to do:
Int_t MyPalette[100]; Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0}; Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0}; Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0}; Double_t stop[] = {0., .25, .50, .75, 1.0}; Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 100); for (int i=0;i<100;i++) MyPalette[i] = FI+i;
Later on to reuse the palette MyPalette it will be enough to do
gStyle->SetPalette(100, MyPalette);
As only one palette is active, one need to use TExec to be able to display plots using different palettes on the same pad. The following macro illustrate this feature.
//Draw color plots using different color palettes. //Author:: Olivier Couet #include "TStyle.h" #include "TColor.h" #include "TF2.h" #include "TExec.h" #include "TCanvas.h" void Pal1() { static Int_t colors[50]; static Bool_t initialized = kFALSE; Double_t Red[3] = { 1.00, 0.00, 0.00}; Double_t Green[3] = { 0.00, 1.00, 0.00}; Double_t Blue[3] = { 1.00, 0.00, 1.00}; Double_t Length[3] = { 0.00, 0.50, 1.00 }; if(!initialized){ Int_t FI = TColor::CreateGradientColorTable(3,Length,Red,Green,Blue,50); for (int i=0; i<50; i++) colors[i] = FI+i; initialized = kTRUE; return; } gStyle->SetPalette(50,colors); } void Pal2() { static Int_t colors[50]; static Bool_t initialized = kFALSE; Double_t Red[3] = { 1.00, 0.50, 0.00}; Double_t Green[3] = { 0.50, 0.00, 1.00}; Double_t Blue[3] = { 1.00, 0.00, 0.50}; Double_t Length[3] = { 0.00, 0.50, 1.00 }; if(!initialized){ Int_t FI = TColor::CreateGradientColorTable(3,Length,Red,Green,Blue,50); for (int i=0; i<50; i++) colors[i] = FI+i; initialized = kTRUE; return; } gStyle->SetPalette(50,colors); } TCanvas* multipalette() { TCanvas *c3 = new TCanvas("c3","C3",0,0,600,400); c3->Divide(2,1); TF2 *f3 = new TF2("f3","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3); f3->SetLineWidth(1); f3->SetLineColor(kBlack); c3->cd(1); f3->Draw("surf1"); TExec *ex1 = new TExec("ex1","Pal1();"); ex1->Draw(); f3->Draw("surf1 same"); c3->cd(2); f3->Draw("surf1"); TExec *ex2 = new TExec("ex2","Pal2();"); ex2->Draw(); f3->Draw("surf1 same"); return c3; }
TColor *col26 = gROOT->GetColor(26); col26->SetAlpha(0.01);
A new color can be created transparent the following way:
Int_t ci = 1756; TColor *color = new TColor(ci, 0.1, 0.2, 0.3, "", 0.5); // alpha = 0.5
An example of tranparency usage with parallel coordinates can be found in $ROOTSYS/tutorials/tree/parallelcoordtrans.C.
To ease the creation of a transparent color the static method GetColorTransparent(Int_t color, Float_t a) is provided. In the following example the trans_red color index point to a red color 30% transparent. The alpha value of the color index kRed is not modified.
Int_t trans_red = GetColorTransparent(kRed, 0.3);
This function is also used in the methods SetFillColorAlpha(), SetLineColorAlpha(), SetMarkerColorAlpha() and SetTextColorAlpha(). In the following example the fill color of the histogram histo is set to blue with a transparency of 35%. The color kBlue itself remains fully opaque.
histo->SetFillColorAlpha(kBlue, 0.35);
The transparency is available on all platforms when the flagOpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc, or on Mac with the Cocoa backend. On the file output it is visible with PDF, PNG, Gif, JPEG, SVG ... but not PostScript.
virtual | ~TColor() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TObject::AppendPad(Option_t* option = "") |
const char* | AsHexString() const |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | Copy(TObject& color) const |
static void | CreateColorsCircle(Int_t offset, const char* name, UChar_t* rgb) |
static void | CreateColorsGray() |
static void | CreateColorsRectangle(Int_t offset, const char* name, UChar_t* rgb) |
static void | CreateColorWheel() |
static Int_t | CreateGradientColorTable(UInt_t Number, Double_t* Stops, Double_t* Red, Double_t* Green, Double_t* Blue, UInt_t NColors, Float_t alpha = 1.) |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
Float_t | GetAlpha() const |
Float_t | GetBlue() const |
static Int_t | GetColor(const char* hexcolor) |
static Int_t | GetColor(ULong_t pixel) |
static Int_t | GetColor(Float_t r, Float_t g, Float_t b) |
static Int_t | GetColor(Int_t r, Int_t g, Int_t b) |
static Int_t | GetColorBright(Int_t color) |
static Int_t | GetColorDark(Int_t color) |
static Int_t | GetColorPalette(Int_t i) |
static Int_t | GetColorTransparent(Int_t color, Float_t a) |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual Float_t | GetGrayscale() const |
Float_t | GetGreen() const |
virtual void | GetHLS(Float_t& h, Float_t& l, Float_t& s) const |
Float_t | GetHue() const |
virtual const char* | TObject::GetIconName() const |
Float_t | GetLight() const |
virtual const char* | TNamed::GetName() const |
Int_t | GetNumber() const |
static Int_t | GetNumberOfColors() |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
ULong_t | GetPixel() const |
Float_t | GetRed() const |
virtual void | GetRGB(Float_t& r, Float_t& g, Float_t& b) const |
Float_t | GetSaturation() const |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
static void | HLS2RGB(Float_t h, Float_t l, Float_t s, Float_t& r, Float_t& g, Float_t& b) |
static void | HLS2RGB(Int_t h, Int_t l, Int_t s, Int_t& r, Int_t& g, Int_t& b) |
static void | HLStoRGB(Float_t h, Float_t l, Float_t s, Float_t& r, Float_t& g, Float_t& b) |
static void | HSV2RGB(Float_t h, Float_t s, Float_t v, Float_t& r, Float_t& g, Float_t& b) |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
static void | InitializeColors() |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
static Bool_t | IsGrayscale() |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
static ULong_t | Number2Pixel(Int_t ci) |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
void | TObject::operator delete(void* ptr) |
void | TObject::operator delete(void* ptr, void* vp) |
void | TObject::operator delete[](void* ptr) |
void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
TColor& | operator=(const TColor&) |
virtual void | TObject::Paint(Option_t* option = "") |
static void | Pixel2RGB(ULong_t pixel, Int_t& r, Int_t& g, Int_t& b) |
static void | Pixel2RGB(ULong_t pixel, Float_t& r, Float_t& g, Float_t& b) |
static const char* | PixelAsHexString(ULong_t pixel) |
virtual void | TObject::Pop() |
virtual void | Print(Option_t* option = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
static void | RGB2HLS(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& l, Float_t& s) |
static void | RGB2HLS(Int_t r, Int_t g, Int_t b, Int_t& h, Int_t& l, Int_t& s) |
static void | RGB2HSV(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& s, Float_t& v) |
static ULong_t | RGB2Pixel(Int_t r, Int_t g, Int_t b) |
static ULong_t | RGB2Pixel(Float_t r, Float_t g, Float_t b) |
static void | RGBtoHLS(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& l, Float_t& s) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
static void | SaveColor(ostream& out, Int_t ci) |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
virtual void | SetAlpha(Float_t a) |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
static void | SetGrayscale(Bool_t set = kTRUE) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
static void | SetPalette(Int_t ncolors, Int_t* colors, Float_t alpha = 1.) |
virtual void | SetRGB(Float_t r, Float_t g, Float_t b) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector& insp) const |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
TColor() | |
TColor(const TColor& color) | |
TColor(Int_t color, Float_t r, Float_t g, Float_t b, const char* name = "", Float_t a = 1) | |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | TObject::MakeZombie() |
static TObject::(anonymous) | TObject::kBitMask | |
static TObject::EStatusBits | TObject::kCanDelete | |
static TObject::EStatusBits | TObject::kCannotPick | |
static TObject::EStatusBits | TObject::kHasUUID | |
static TObject::EStatusBits | TObject::kInvalidObject | |
static TObject::(anonymous) | TObject::kIsOnHeap | |
static TObject::EStatusBits | TObject::kIsReferenced | |
static TObject::EStatusBits | TObject::kMustCleanup | |
static TObject::EStatusBits | TObject::kNoContextMenu | |
static TObject::(anonymous) | TObject::kNotDeleted | |
static TObject::EStatusBits | TObject::kObjInCanvas | |
static TObject::(anonymous) | TObject::kOverwrite | |
static TObject::(anonymous) | TObject::kSingleKey | |
static TObject::(anonymous) | TObject::kWriteDelete | |
static TObject::(anonymous) | TObject::kZombie |
TString | TNamed::fName | object identifier |
Int_t | fNumber | Color number identifier |
TString | TNamed::fTitle | object title |
Float_t | fAlpha | Alpha (transparency) |
Float_t | fBlue | Fraction of Blue |
Float_t | fGreen | Fraction of Green |
Float_t | fHue | Hue |
Float_t | fLight | Light |
Float_t | fRed | Fraction of Red |
Float_t | fSaturation | Saturation |
static Bool_t | fgGrayscaleMode | if set, GetColor will return grayscale |
static Bool_t | fgInitDone | kTRUE once ROOT colors have been initialized |
static TArrayI | fgPalette | Color palette |
Normal color constructor. Initialize a color structure. Compute the RGB and HLS color components.
Initialize colors used by the TCanvas based graphics (via TColor objects). This method should be called before the ApplicationImp is created (which initializes the GUI colors).
Return color as hexadecimal string. This string can be directly passed to, for example, TGClient::GetColorByName(). String will be reused so copy immediately if needed.
Create the "circle" colors in the color wheel.
Create the "rectangular" colors in the color wheel.
Return pixel value corresponding to this color. This pixel value can be used in the GUI classes. This call does not work in batch mode since it needs to communicate with the graphics system.
Static method to compute RGB from HLS. The l and s are between [0,1] and h is between [0,360]. The returned r,g,b triplet is between [0,1].
Static method to compute RGB from HLS. The h,l,s are between [0,255]. The returned r,g,b triplet is between [0,255].
Static method to compute RGB from HSV:
Static method to compute HLS from RGB. The r,g,b triplet is between [0,1], hue is between [0,360], light and satur are [0,1].
Static method to compute HSV from RGB.
Static method to compute HLS from RGB. The r,g,b triplet is between [0,255], hue, light and satur are between [0,255].
Static method returning color number for color specified by hex color string of form: #rrggbb, where rr, gg and bb are in hex between [0,FF], e.g. "#c0c0c0".
Static method returning color number for color specified by r, g and b. The r,g,b should be in the range [0,1].
Static method returning color number for color specified by system dependent pixel value. Pixel values can be obtained, e.g., from the GUI color picker.
Static method returning color number for color specified by r, g and b. The r,g,b should be in the range [0,255]. If the specified color does not exist it will be created with as name "#rrggbb" with rr, gg and bb in hex between [0,FF].
Static function: Returns the bright color number corresponding to n If the TColor object does not exist, it is created. The convention is that the bright color nb = n+150
Static function: Returns the dark color number corresponding to n If the TColor object does not exist, it is created. The convention is that the dark color nd = n+100
Static function: Returns the transparent color number corresponding to n. The transparency level is given by the alpha value a.
Static method that given a color index number, returns the corresponding pixel value. This pixel value can be used in the GUI classes. This call does not work in batch mode since it needs to communicate with the graphics system.
Convert r,g,b to graphics system dependent pixel value. The r,g,b triplet must be [0,1].
Convert r,g,b to graphics system dependent pixel value. The r,g,b triplet must be [0,255].
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::GetPixel()) to r,g,b triplet. The r,g,b triplet will be [0,1].
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::GetPixel()) to r,g,b triplet. The r,g,b triplet will be [0,255].
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::GetPixel()) to a hexadecimal string. This string can be directly passed to, for example, TGClient::GetColorByName(). String will be reused so copy immediately if needed.
Save a color with index > 228 as a C++ statement(s) on output stream out.
Static function creating a color table with several connected linear gradients.
The table is constructed by tracing lines between the given points in RGB space. Each color value may have a value between 0 and 1. The difference between consecutive "Stops" values gives the fraction of space in the whole table that should be used for the interval between the corresponding color values.
Normally the first element of Stops should be 0 and the last should be 1. If this is not true, fewer than NColors will be used in proportion with the total interval between the first and last elements of Stops.
This definition is similar to the povray-definition of gradient color tables.
For instance:
UInt_t Number = 3; Double_t Red[3] = { 0.0, 1.0, 1.0 }; Double_t Green[3] = { 0.0, 0.0, 1.0 }; Double_t Blue[3] = { 1.0, 0.0, 1.0 }; Double_t Stops[3] = { 0.0, 0.4, 1.0 };This defines a table in which there are three color end points: RGB = {0, 0, 1}, {1, 0, 0}, and {1, 1, 1} = blue, red, white The first 40% of the table is used to go linearly from blue to red. The remaining 60% of the table is used to go linearly from red to white.
If you define a very short interval such that less than one color fits in it, no colors at all will be allocated. If this occurs for all intervals, ROOT will revert to the default palette.
Original code by Andreas Zoglauer (zog@mpe.mpg.de)
Static function. The color palette is used by the histogram classes (see TH1::Draw options). For example TH1::Draw("col") draws a 2-D histogram with cells represented by a box filled with a color CI function of the cell content. if the cell content is N, the color CI used will be the color number in colors[N],etc. If the maximum cell content is > ncolors, all cell contents are scaled to ncolors.
if ncolors <= 0 a default palette (see below) of 50 colors is defined. The colors defined in this palette are OK for coloring pads, labels.
index 0->9 : grey colors from light to dark grey index 10->19 : "brown" colors index 20->29 : "blueish" colors index 30->39 : "redish" colors index 40->49 : basic colors
if ncolors == 1 && colors == 0, a Rainbow Color map is created with 50 colors. It is kept for backward compatibility. Better palettes like kBird are recommended.
High quality predefined palettes with 255 colors are available when colors == 0. The following value of ncolors give access to:
if ncolors = 51 and colors=0, a Deep Sea palette is used. if ncolors = 52 and colors=0, a Grey Scale palette is used. if ncolors = 53 and colors=0, a Dark Body Radiator palette is used. if ncolors = 54 and colors=0, a Two-Color Hue palette is used.(dark blue through neutral gray to bright yellow) if ncolors = 55 and colors=0, a Rain Bow palette is used. if ncolors = 56 and colors=0, an Inverted Dark Body Radiator palette is used. if ncolors = 57 and colors=0, a monotonically increasing L value palette is used. if ncolors = 58 and colors=0, a Cubehelix palette is used (Cf. Dave Green's "cubehelix" colour scheme at http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/) if ncolors = 59 and colors=0, a Green Red Violet palette is used. if ncolors = 60 and colors=0, a Blue Red Yellow palette is used. if ncolors = 61 and colors=0, an Ocean palette is used. if ncolors = 62 and colors=0, a Color Printable On Grey palette is used. if ncolors = 63 and colors=0, an Alpine palette is used. if ncolors = 64 and colors=0, an Aquamarine palette is used. if ncolors = 65 and colors=0, an Army palette is used. if ncolors = 66 and colors=0, an Atlantic palette is used. if ncolors = 67 and colors=0, an Aurora palette is used. if ncolors = 68 and colors=0, an Avocado palette is used. if ncolors = 69 and colors=0, a Beach palette is used. if ncolors = 70 and colors=0, a Black Body palette is used. if ncolors = 71 and colors=0, a Blue Green Yellow palette is used. if ncolors = 72 and colors=0, a Brown Cyan palette is used. if ncolors = 73 and colors=0, a CMYK palette is used. if ncolors = 74 and colors=0, a Candy palette is used. if ncolors = 75 and colors=0, a Cherry palette is used. if ncolors = 76 and colors=0, a Coffee palette is used. if ncolors = 77 and colors=0, a Dark Rain Bow palette is used. if ncolors = 78 and colors=0, a Dark Terrain palette is used. if ncolors = 79 and colors=0, a Fall palette is used. if ncolors = 80 and colors=0, a Fruit Punch palette is used. if ncolors = 81 and colors=0, a Fuchsia palette is used. if ncolors = 82 and colors=0, a Grey Yellow palette is used. if ncolors = 83 and colors=0, a Green Brown Terrain palette is used. if ncolors = 84 and colors=0, a Green Pink palette is used. if ncolors = 85 and colors=0, an Island palette is used. if ncolors = 86 and colors=0, a Lake palette is used. if ncolors = 87 and colors=0, a Light Temperature palette is used. if ncolors = 88 and colors=0, a Light Terrain palette is used. if ncolors = 89 and colors=0, a Mint palette is used. if ncolors = 90 and colors=0, a Neon palette is used. if ncolors = 91 and colors=0, a Pastel palette is used. if ncolors = 92 and colors=0, a Pearl palette is used. if ncolors = 93 and colors=0, a Pigeon palette is used. if ncolors = 94 and colors=0, a Plum palette is used. if ncolors = 95 and colors=0, a Red Blue palette is used. if ncolors = 96 and colors=0, a Rose palette is used. if ncolors = 97 and colors=0, a Rust palette is used. if ncolors = 98 and colors=0, a Sandy Terrain palette is used. if ncolors = 99 and colors=0, a Sienna palette is used. if ncolors = 100 and colors=0, a Solar palette is used. if ncolors = 101 and colors=0, a South West palette is used. if ncolors = 102 and colors=0, a Starry Night palette is used. if ncolors = 103 and colors=0, a Sunset palette is used. if ncolors = 104 and colors=0, a Temperature Map palette is used. if ncolors = 105 and colors=0, a Thermometer palette is used. if ncolors = 106 and colors=0, a Valentine palette is used. if ncolors = 107 and colors=0, a Visible Spectrum palette is used. if ncolors = 108 and colors=0, a Water Melon palette is used. if ncolors = 109 and colors=0, a Cool palette is used. if ncolors = 110 and colors=0, a Copper palette is used. if ncolors = 111 and colors=0, a Gist Earth palette is used.These palettes can also be accessed by names:
kDeepSea=51, kGreyScale=52, kDarkBodyRadiator=53, kBlueYellow= 54, kRainBow=55, kInvertedDarkBodyRadiator=56, kBird=57, kCubehelix=58, kGreenRedViolet=59, kBlueRedYellow=60, kOcean=61, kColorPrintableOnGrey=62, kAlpine=63, kAquamarine=64, kArmy=65, kAtlantic=66, kAurora=67, kAvocado=68, kBeach=69, kBlackBody=70, kBlueGreenYellow=71, kBrownCyan=72, kCMYK=73, kCandy=74, kCherry=75, kCoffee=76, kDarkRainBow=77, kDarkTerrain=78, kFall=79, kFruitPunch=80, kFuchsia=81, kGreyYellow=82, kGreenBrownTerrain=83, kGreenPink=84, kIsland=85, kLake=86, kLightTemperature=87, kLightTerrain=88, kMint=89, kNeon=90, kPastel=91, kPearl=92, kPigeon=93, kPlum=94, kRedBlue=95, kRose=96, kRust=97, kSandyTerrain=98, kSienna=99, kSolar=100, kSouthWest=101, kStarryNight=102, kSunset=103, kTemperatureMap=104, kThermometer=105, kValentine=106, kVisibleSpectrum=107, kWaterMelon=108, kCool=109, kCopper=110, kGistEarth=111For example:
gStyle->SetPalette->(kBird);Set the current palette as "Bird" (number 57).
The color numbers specified in the palette can be viewed by selecting the item "colors" in the "VIEW" menu of the canvas toolbar. The color parameters can be changed via TColor::SetRGB.
Note that when drawing a 2D histogram h2 with the option "COL" or "COLZ" or with any "CONT" options using the color map, the number of colors used is defined by the number of contours n specified with: h2->SetContour(n)
{ h=GetHue(); l=GetLight(); s=GetSaturation(); }