2
$\begingroup$

How can I extract the colors used by default in the BulletGauge?

enter image description here

$\endgroup$
  • $\begingroup$ You mean you want to know which colours are used in the bar, the darkred,blue,greenish etc.? $\endgroup$ – Feyre Aug 16 '16 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 Ike Aug 16 '16 at 8:34
7
$\begingroup$

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"]

enter image description here

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]
$\endgroup$
  • $\begingroup$ @mr-wizard Yes, that´s the answer! $\endgroup$ – Mika Ike Aug 16 '16 at 8:45
3
$\begingroup$

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]

enter image description here

$\endgroup$
  • $\begingroup$ ok, I like it,... but... How can I know that BulletGauges use the secuence number 63? $\endgroup$ – Mika Ike Aug 16 '16 at 8:43
  • 1
    $\begingroup$ @MikaIke I updated the answer on your other question. $\endgroup$ – Feyre Aug 16 '16 at 8:45
  • $\begingroup$ @MikaIke Which has now been rolled back, so I edited my answer here. $\endgroup$ – Feyre Aug 16 '16 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.