1
$\begingroup$

I like to use the basic geometric regions in Mathematica, like Parallelogram[...], Rectangle[...], Circle[...], but I don't like the default solid black color that Mathematica uses when I show the 2D-regions with Graphics[Triangle[]].

I like the color for the 3D-regions (light brown/orange), is there a way to use this (or another) color as the default color to the 2D regions?

$\endgroup$
3
  • $\begingroup$ Graphics[{Orange,Disk[]}] $\endgroup$
    – cvgmt
    Commented Jun 4, 2021 at 13:09
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Jun 4, 2021 at 16:16
  • 1
    $\begingroup$ Note that the color of Graphics3D[{Cone[]}] is white that is shaded according to the Lighting. (See FrontFaceColor /. CurrentValue[{StyleDefinitions, "Graphics3D"}] and compare with FrontFaceColor /. CurrentValue[{StyleDefinitions, "Graphics"}]. There is also BackFaceColor.) $\endgroup$
    – Michael E2
    Commented Jun 4, 2021 at 19:38

2 Answers 2

1
$\begingroup$

To set the 2d graphics default (here, to Red), use

SetOptions[Graphics, BaseStyle -> Red];

Then,

Graphics[Triangle[]]

enter image description here

Subsequent commands, like Graphics[Circle[]], also yield Red images by default. Many other default options also can be set in the same way. Remove the ; from the first command to see them.

On the other hand, if you wish this default to persist across Notebooks, you must edit aStyleSheet, along the lines of my answer to 246885

$\endgroup$
1
  • 3
    $\begingroup$ You could also use SetOptions[Graphics, BaseStyle -> {"PolygonBoxOptions" -> {BaseStyle -> {Red}}}] for a more targeted approach. $\endgroup$
    – Carl Woll
    Commented Jun 4, 2021 at 16:08
0
$\begingroup$

See Graphics:

enter image description here

Example follows giving a number of ways to set the color (not certain one can set the "Default" color, but someone else may comment):

Graphics[{#, Triangle[]}] & /@ {
  CMYKColor[1, 0, 1, 0, .5],
  CMYKColor[0.3, 1, 0, .25],
  Lighter[CMYKColor[0, 0, 1, 0], .4],
  CMYKColor[0, 0, 1, 0],
  Darker[CMYKColor[0, 0, 1, 0], .4],
  RGBColor[1, 0, 0],
  Blend[{RGBColor[1, 0, 0], RGBColor[0, 0, 1]}],
  RGBColor[0, 0, 1],
  Hue[0.25, 1, 1, .5],
  Hue[0.5, 1, 1, .5]
  }

enter image description here

You can also do things like the following:

Graphics[{
   CMYKColor[1, 0, 1, 0, .5], 
   PatternFilling["Checkerboard"],
   Triangle[]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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