Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* To preserve the current stylesheet information it has to be
- plucked out of the StyleDefinitions; 1st time this is OK as the
- StyleDefinitions = just a notebook name, but after adding items it
- gets messy and we need to extract the stylesheet notebook name to reapply it.
- *)
- sdef = CurrentValue[EvaluationNotebook[], StyleDefinitions];
- If[! StringQ[sdef], (*
- this is typically just the filename of a stylesheet notebook,
- but if it isn't... *)
- sdef = ToString[sdef];
- sdef = StringCases[sdef, "StyleDefinitions -> " ~~ __ ~~ ".nb]]",
- 1];
- sdef = StringReplace[
- sdef[[1]], {"StyleDefinitions -> " -> "", "]]" -> ""}]
- ];
- SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{
- Cell[StyleData[StyleDefinitions -> sdef]],
- Cell[StyleData["MessageMenuLabel"], Bold,
- FontColor -> RGBColor[N[174/255], 0.1, 0],
- FontSize ->
- CurrentValue[{StyleDefinitions, "Output", "FontSize"}]],
- Cell[StyleData["MessageText"],
- FontColor -> RGBColor[0.1, 0.1, 0.1]]
- }
- ]
- (* last line needed per Kuba's Programming scripts to create and modify stylesheets answer*)
- /. s_Symbol /; Context[s] === "Global`" :>
- Symbol["FrontEnd`" <> SymbolName[s]]]
- (* Do something illegal to check the message appearance... *)
- 1/0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement