How can I extract the colors used by default in the BulletGauge?
-
$\begingroup$ You mean you want to know which colours are used in the bar, the darkred,blue,greenish etc.? $\endgroup$– FeyreCommented Aug 16, 2016 at 8:29
-
$\begingroup$ @Feyre For a rude use I would use a pick up color of paint-design colors. What I want is the list of colors, as colors as mathematica knows it, or as you describe for a future swaping $\endgroup$– Mika IkeCommented Aug 16, 2016 at 8:34
2 Answers
Trace
A programmatic approach using Trace
:
Trace[
BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8}],
_ColorData
] // Flatten // First
ColorData[63, 1]
Check:
ColorData[63, "ColorList"]
Related examples:
Spelunking
This can also be found by spelunking the definition of BulletGauge
itself using tools from:
One find that the inner definition is Charting`iLinearGauge
Needs["GeneralUtilities`"]
PrintDefinitions @ Charting`iLinearGauge
Within that one finds a hard-coded color source:
Charting`padList[{{ColorData[63][#1] &, None}}, numvals]
-
$\begingroup$ @mr-wizard Yes, that´s the answer! $\endgroup$– Mika IkeCommented Aug 16, 2016 at 8:45
Here's what I did:
All Mathematica plotting functions use a range of ColorData[]
.
Table[ColorData[i, "ColorList"], {i, 1, 96}] // TableForm
Prints all the ColorData
lists.
From this you can count (you can change the range of the Table[]
), that the one you want is nr63
.
ColorData[63, "ColorList"]
Gives this list.
colours = ColorData[63, "ColorList"]
a = colours[[5]]
colours[[5]] = colours[[6]];
colours[[6]] = a
BulletGauge[{1, 1.8, 3, 3.4, 4, 5}, {2.4, 2.9}, {0, 3.5, 4.8},
ImageSize -> Large, GaugeStyle -> colours]
-
$\begingroup$ ok, I like it,... but... How can I know that BulletGauges use the secuence number 63? $\endgroup$– Mika IkeCommented Aug 16, 2016 at 8:43
-
1$\begingroup$ @MikaIke I updated the answer on your other question. $\endgroup$– FeyreCommented Aug 16, 2016 at 8:45
-
$\begingroup$ @MikaIke Which has now been rolled back, so I edited my answer here. $\endgroup$– FeyreCommented Aug 16, 2016 at 8:48