3

I would like to change (from the stylesheet) the colors of the error messages. For example, trying to evaluate

Solve[wrongsyntax = 0, var] gives an obvious error message. The Solve from the error message is in red and the message/comment is in gray. Is there a way to change these colors? I tried via AutoStyleOptions, but none of the options seemed to affect either.

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
Patrick.B
  • 1,399
  • 5
  • 11

1 Answers1

5

Follow steps in this answer to create Default.nb in your $UserBaseDirectory. (replace Package.nb with Default.nb first!)

Then add those style cells:

Cell[StyleData["MessageMenuLabel"], FontColor->RGBColor[0, 0, 1]]

Cell[StyleData["MessageText"], FontColor->RGBColor[1, 0, 1]]

You may need to restart MMA but it should work:

enter image description here

How did I know which styles? Ctrl+Shift+E reveals styles used in messages:

Cell[BoxData[
  TemplateBox[{ "Solve","naqs", ...},  "MessageTemplate"]], 
  "MessagesWindowMessage", "MSG", ShowCellLabel->True, ...
]

And CurrentValue[{StyleDefinitions, "MessageTemplate"}] reveals DisplayFunction:

{TemplateBoxOptionsDisplayFunction -> (RowBox[{
    TooltipBox[
      ..., 
      RowBox[{#1, "::", #2}], BaseStyle -> "MessageMenuLabel"
    ], 
   ":", " ", StyleBox[#3, "MessageText"]}] &), ...
   }
Kuba
  • 136,707
  • 13
  • 279
  • 740