9
$\begingroup$

In Mathematica 7, the default plot color is a purple-like color (although I think it is not Purple). Is it possible to use Mathematica to determine the RGB color values of the default plot color? Thanks for your time.

$\endgroup$
11
$\begingroup$

All the default colors can be found in ColorData[1]. To obtain the RGB value of the first color you just need to type:

ColorData[1, 1]
(* RGBColor[0.2472, 0.24, 0.6] *)

To check all subsequent colors just change the n in ColorData[1, n]. To obtain the values on the scale 0 to 255:

Round[Rescale[Table[ColorData[1, 1][[i]], {i, 3}], {0, 1}, {0, 255}]]
(* {63, 61, 153} *)
$\endgroup$
  • $\begingroup$ Thanks! So, if (as in other programs) the RGB values are on a scale from 0 to 255, I just need to multiply the Mathematica RGB values by 255? $\endgroup$ – Andrew Oct 9 '12 at 17:23
  • 1
    $\begingroup$ @Andrew See update. $\endgroup$ – VLC Oct 9 '12 at 17:25
  • 1
    $\begingroup$ v10.3 255(List@@ColorData[97,n]) $\endgroup$ – Praan Dec 15 '15 at 10:30
7
$\begingroup$

ColorData[1,"ColorList"] gives the full list for the default colour set.

enter image description here

$\endgroup$
4
$\begingroup$

The closest source of the default style colors I could find is this internal function:

System`Private`$PlotStyleFunction[3]
{{Hue[0.67, 0.6, 0.6]}, {Hue[0.906068, 0.6, 0.6]}, {Hue[0.142136, 0.6, 0.6]}}

Yielding e.g. the first three style colors. These as noted by others are exceedingly close to ColorData[1], the function of which is:

ColorData[1][[4]]
(ToColor[Hue[N[FractionalPart[0.67 + (2 (#1 - 1))/GoldenRatio]], 0.6, 0.6],
  RGBColor] &)[Floor[#1 - 1, 1] + 1] &

If you are interested in changing the defaults don't miss:

How to change the default ColorData used in Mathematica's Plot?

$\endgroup$
  • 1
    $\begingroup$ Since System`Private`$PlotStyleFunction returns HSB values as opposed to RGB values, if you want to see the RGB values, do this: ColorConvert[#, RGBColor] & /@ Flatten[System`Private`$PlotStyleFunction[3]]. $\endgroup$ – J. M. will be back soon Oct 9 '12 at 22:37
2
$\begingroup$

The default color is Hue[0.67, 0.6, 0.6]

$\endgroup$
  • 1
    $\begingroup$ How did you determine this or where did you find this documented? -- Thx $\endgroup$ – Jagra Oct 9 '12 at 16:57
  • $\begingroup$ Thanks. Is it possible to convert those values to RGB values used in many paint programs? $\endgroup$ – Andrew Oct 9 '12 at 16:57
  • $\begingroup$ Also, it seems that in some programs (for example, Microsoft Word 2003), HSL values go from 0 to 255, not 0 to 1 as in Mathematica. I guess, then, I should just multiply by 255 and round to the nearest integer? $\endgroup$ – Andrew Oct 9 '12 at 17:00
  • 1
    $\begingroup$ @Andrew Yes, certainly. $\endgroup$ – Alexey Popkov Oct 9 '12 at 17:33

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.