This used to work but I accidentally made some unrecoverable edits and it stopped displaying. It supposed to adjust the background color of the current notebook. Please have a look and see what is wrong.

notebookBackgroundGraySlider[] := Module[{x = 1},
   Background -> Dynamic[RGBColor[x, x, x]]];
  • $\begingroup$ With 1; 2 the 1 won't be displayed either. $\endgroup$
    – Kuba
    Jun 25 '20 at 8:55

I'm guessing you want this?

notebookBackgroundGraySlider[] := DynamicModule[{x = 1},
     x = #;
     SetOptions[EvaluationNotebook[], Background -> Dynamic[RGBColor[x, x, x]]]
  • $\begingroup$ If you SetOptions each time then there's no need for Dynamic in the option. Regardless of where and when SetOptions is done the Dynamic with a local variable can lead to troubles in a new session. But maybe it does not matter, depends on the context. $\endgroup$
    – Kuba
    Jun 25 '20 at 9:09
  • $\begingroup$ @SjoerdSmit it looks a little different from the way I had it before (when it worked) but who cares this works perfect. Thank you so much. $\endgroup$ Jun 25 '20 at 9:14
  • $\begingroup$ @Kuba True. I haven't tested how this persists between sessions or anything, so it will probably need tweaking. $\endgroup$ Jun 25 '20 at 9:35

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.