3
$\begingroup$

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

$\endgroup$
5
$\begingroup$

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"]}] &), ...
   }
$\endgroup$

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.