Commit 34271b3
committed
[core] Add "kWhite" and "kBlack" to the special TColorNumber map
There is a map in the TColorNumber constructor to get colors by special
name. The "kWhite" and "kBlack" keys have to be added there, as these
are the only color names that don't have have a corresponding entry in
the global list of colors.
Unfortunately, we can't add "kWhite" and "kBlack" to the global list of
colors, because the indices corresponding to these enum values are
alredy taken by "background" and "black". And using different indices
would break the 1-to-1 correspondence between the color enum integer
values and the global color names. That's why we just treat them as
special colors in the TColorNumber constructor.
You can verify that kBlack and kWhite are special with this code:
```c++
// all the EColor enum values
#define COLOR_LIST \
X(kWhite) \
X(kBlack) \
X(kGray) \
X(kRed) \
X(kGreen) \
X(kBlue) \
X(kYellow) \
X(kMagenta) \
X(kCyan) \
X(kOrange) \
X(kSpring) \
X(kTeal) \
X(kAzure) \
X(kViolet) \
X(kPink) \
X(kGrape) \
X(kBrown) \
X(kAsh) \
X(kP6Blue) \
X(kP6Yellow) \
X(kP6Red) \
X(kP6Grape) \
X(kP6Gray) \
X(kP6Violet) \
X(kP8Blue) \
X(kP8Orange) \
X(kP8Red) \
X(kP8Pink) \
X(kP8Green) \
X(kP8Cyan) \
X(kP8Azure) \
X(kP8Gray) \
X(kP10Blue) \
X(kP10Yellow) \
X(kP10Red) \
X(kP10Gray) \
X(kP10Violet) \
X(kP10Brown) \
X(kP10Orange) \
X(kP10Green) \
X(kP10Ash) \
X(kP10Cyan)
#define X(color) std::cout << TColor::GetColorByName(#color) << " " << color << std::endl;
COLOR_LIST
#undef X
```
The output will be:
```txt
-1 0
-1 1
920 920
632 632
416 416
600 600
400 400
616 616
432 432
800 800
820 820
840 840
860 860
880 880
900 900
100 100
101 101
102 102
103 103
104 104
105 105
106 106
107 107
108 108
109 109
110 110
111 111
112 112
113 113
114 114
115 115
116 116
117 117
118 118
119 119
120 120
121 121
122 122
123 123
124 124
125 125
126 126
```1 parent f80ee47 commit 34271b3
File tree
3 files changed
+83
-3
lines changed- bindings/pyroot/pythonizations/test
- core/base/src
3 files changed
+83
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3696 | 3696 | | |
3697 | 3697 | | |
3698 | 3698 | | |
3699 | | - | |
3700 | | - | |
3701 | | - | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
3702 | 3708 | | |
3703 | 3709 | | |
3704 | 3710 | | |
| |||
0 commit comments