4
$\begingroup$

how may I find the name or definitions of colors which are used by default in Plots. I use WM12 ie, if I plot some function it has "blue" colour, next function has "orange" colour. If I need to plot something else corresponding to these curves I would like to use the same colour but I don't know the names of these colours. If I use Blue it is not the same as "blue" used in the plot. Ok, I may choose all colours by me in PlotStyle but do not look for an alternative solution, I'm interested in the default plot colours.

Thank you all, for help.

$\endgroup$
2

2 Answers 2

6
$\begingroup$
defaultplotcolors =  Cases[#, _?ColorQ, All] &[
  "DefaultPlotStyle" /. (Method /. Charting`ResolvePlotTheme[Automatic, Plot])]

enter image description here

Alternatively,

defaultColor = "DefaultColor" /. Themes`DefaultStyles[Plot][[All, 2]]
97
ColorData[defaultColor, "ColorList"]

enter image description here

Update: Default colors for various PlotThemes`:

 {#, Cases[#, _?ColorQ, All] &["DefaultPlotStyle" /. 
  (Method /. Charting`ResolvePlotTheme[#, Plot])]} & /@ 
  {Automatic, "Marketing", "Business", "Web", "Scientific"} // 
 Prepend[{"theme", "colors"}] // Grid

enter image description here

$\endgroup$
2
$\begingroup$

You can make a plot of n functions and extract from the result the color specifications.

E.g. with 3 functions:

t = Plot[{Sin[x], Cos[x], Tan[x]}, {x, 0, 2 Pi}];

You may look at "FullForm[t]" and note that there are color specifications in the form of "RGBColors[,,_]". You may pick these out by:

Cases[t, RGBColor[__], Infinity] // FullForm

enter image description here

or visual:

Cases[t, RGBColor[__], Infinity]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Easier ColorData[97, "ColorList"]. $\endgroup$ May 12, 2021 at 12:02

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