2

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

enter image description here

Mika Ike
  • 3,241
  • 1
  • 23
  • 38
  • You mean you want to know which colours are used in the bar, the darkred,blue,greenish etc.? – Feyre Aug 16 '16 at 08:29
  • @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 – Mika Ike Aug 16 '16 at 08:34

2 Answers2

7

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]
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
3

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

Feyre
  • 8,597
  • 2
  • 27
  • 46