1
$\begingroup$

(Not a duplicate. I've checked How to "undo" SetOptions (restore defaults)? and others.)

Suppose I change some display options, e.g.:

SetOptions[EvaluationNotebook[], Background -> RGBColor[0.0, 0.0, 0.0], FontColor -> RGBColor[0, .85, .85], FontSize -> 20]

Is there a way to restore all the default display options at once, in a line or two of code, without rebooting the notebook or digging through the menus? Something like SetOptions[EvaluationNotebook[], Defaults] or a similar idea? I haven't been able to find what I need in other questions.

$\endgroup$
0
$\begingroup$

Yes,

SetOptions[EvaluationNotebook[], Background -> Inherited, FontColor -> Inherited, 
 FontSize -> Inherited]

works in your case. Basically, when working with FrontEnd options Inherited is what you mean by "Default". But it doesn't always work through SetOptions, CurrentValue usually is a better choice.


Update. For "UndefinedSymbolStyle" discussed in the comments two solutions were found working:

SetOptions[EvaluationNotebook[], AutoStyleOptions -> {"UndefinedSymbolStyle" -> Inherited}]

CurrentValue[EvaluationNotebook[], {AutoStyleOptions, "UndefinedSymbolStyle"}] = Inherited
$\endgroup$
  • $\begingroup$ That works great! Thank you! Follow-up question: I had used CurrentValue[EvaluationNotebook[], {AutoStyleOptions, "UndefinedSymbolStyle"}] = {FontColor -> RGBColor[0.5, 0.173, 0.765]} to edit the color of variable names to fit within the high-contrast color theme, but when I try to set FontColor -> Inherited then everything turns black (instead of the default variable color of blue). Do you know how to fix that, or should I post as a separate question? Thanks for your help! $\endgroup$ – ichthyophile Oct 29 '19 at 21:01
  • $\begingroup$ @icthyophile SetOptions[EvaluationNotebook[], AutoStyleOptions -> {"UndefinedSymbolStyle" -> Inherited}] works. Please report the problem to the tech support (support(at)wolfram.com), I strongly suspect that we have a bug in CurrentValue for CurrentValue[ EvaluationNotebook[], {AutoStyleOptions, "UndefinedSymbolStyle", FontColor}] = Inherited (it is the correct usage). $\endgroup$ – Alexey Popkov Oct 30 '19 at 1:14
  • 1
    $\begingroup$ Thanks so much for that! Your first solution worked great. I also tried CurrentValue[EvaluationNotebook[], {AutoStyleOptions, "UndefinedSymbolStyle"}] = Inherited and it worked. You solved what a half-hour of my searching couldn't figure out. Thanks for your help! $\endgroup$ – ichthyophile Oct 30 '19 at 15:06

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.