TColor *color = gROOT->GetColor(kOrange);
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 (eg 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. We strongly recommend to use these keywords in your code instead of hardcoded color numbers, eg:
myObject.SetFillColor(kRed); myObject.SetFillColor(kYellow-10); myLine.SetLineColor(kMagenta+2);
{ TColorWheel *w = new TColorWheel(); w->Draw(); return w->GetCanvas(); }
TColor *dark = TColor::GetColorDark(color_index); TColor *bright = TColor::GetColorBright(color_index);
{ TColorWheel *w = new TColorWheel(); w->Draw(); w->GetCanvas()->SetGrayscale(); w->GetCanvas()->Modified(); w->GetCanvas()->Update(); return w->GetCanvas(); }
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) | |
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* Length, Double_t* Red, Double_t* Green, Double_t* Blue, UInt_t NColors) |
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) |
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) |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static 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(basic_ostream<char,char_traits<char> >& out, Option_t* option = "") |
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) |
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, char* parent) |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer& b) |
void | StreamerNVirtual(TBuffer& b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
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() |
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
TString | TNamed::fName | object 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 |
Int_t | fNumber | Color number identifier |
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 parameters
Return color as hexidecimal 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. - The hue value runs from 0 to 360. - The saturation is the degree of strength or purity and is from 0 to 1. Purity is how much white is added to the color, so S=1 makes the purest color (no white). - Brightness value also ranges from 0 to 1, where 0 is the black. The returned r,g,b triplet is between [0,1].
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. - r,g,b triplet is between [0,1]. The returned value: - The hue value runs from 0 to 360. - The saturation is the degree of strength or purity and is from 0 to 1. Purity is how much white is added to the color, so S=1 makes the purest color (no white). - Brightness value also ranges from 0 to 1, where 0 is the black.
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". If specified color does not exist it will be created with as name "#rrggbb" with rr, gg and bb in hex between [0,FF].
Static method returning color number for color specified by
r, g and b. The r,g,b should be in the range [0,1].
If specified color does not exist it will be created
with as name "#rrggbb" with rr, gg and bb in hex between
[0,FF].
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 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 hexidecimal 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. Linear gradient color table: Red, Green and Blue are several RGB colors with values from 0.0 .. 1.0. Their number is "Intervals". Length is the length of the color interval between the RGB-colors: Imaging the whole gradient goes from 0.0 for the first RGB color to 1.0 for the last RGB color, then each "Length"-entry in between stands for the length of the intervall between the according RGB colors. This definition is similar to the povray-definition of gradient color tables. In order to create a color table do the following: Define the RGB Colors: > UInt_t Number = 5; > Double_t Red[5] = { 0.00, 0.09, 0.18, 0.09, 0.00 }; > Double_t Green[5] = { 0.01, 0.02, 0.39, 0.68, 0.97 }; > Double_t Blue[5] = { 0.17, 0.39, 0.62, 0.79, 0.97 }; Define the length of the (color)-interval between this points > Double_t Stops[5] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; i.e. the color interval between Color 2 and Color 3 is 0.79 - 0.62 => 17 % of the total palette area between these colors 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 if ncolors == 1 && colors == 0, then a Pretty Palette with a Spectrum Violet->Red is created. It is recommended to use this Pretty palette when drawing legos, surfaces or contours. if ncolors > 50 and colors=0, the DeepSea palette is used. (see TStyle::CreateGradientColorTable for more details) if ncolors > 0 and colors = 0, the default palette is used with a maximum of ncolors. The default palette defines: 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 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.
{ h=GetHue(); l=GetLight(); s=GetSaturation(); }