# How to change default notebook background color?

How does one change the default notebook background color?

-

You can SetOptions for the current notebook as:

SetOptions[EvaluationNotebook[], Background -> LightGreen]


to change the background to whatever colour you like. You can also supply an RGB colour as:

SetOptions[EvaluationNotebook[], Background -> RGBColor[0.9, 0.7, 0.7]]


Other possibilities for the first argument of SetOptions are

• $FrontEnd which will change the background for all notebooks and last across restarting Mathematica. • $FrontEndSession which will change the background for all notebooks but won't be saved if you restart Mathematica.

-
@Brett Thanks for the edits. I've been trying to look at making changes to the stylesheet, but couldn't figure out which style to change. I thought Cell[StyleData["Notebook"],Background -> LightBlue] should work, but it doesn't. Any clue? – R. M. Feb 6 '12 at 3:35
If you select the All item from the popup list of styles in the stylesheet editor, that should work. – Brett Champion Feb 6 '12 at 3:39
@R.M you cannot use named colours in style sheets you have to use e.g. Cell[StyleData["Notebook"],Background ->RGBColor[0.87, 0.94, 1]] – Mike Honeychurch Feb 6 '12 at 3:46
I like this answer because it will allow me to make changes programmatically, thanks – Tim Feb 6 '12 at 3:48
@GustavoBandeira If by "text", you mean input text (or code), then see this answer of mine that describes the various tokens that control the different colours. If you mean normal text, then the idea is the same — you modify the stylesheet, except that now you choose Text from the dropdown menu instead of StandardForm or anything else. – R. M. Nov 30 '12 at 18:10

You could create a custom stylesheet that has a different background color and define it to be the default one. To do that, go to Format | Edit Stylesheet, select All in the "Choose a style" combo box. Select the appearing entry in the list below and set your appropriate style definitions for it, in your case that would be another background color using Format | Background Color. The new window should look somewhat like this:

You can now select File | Save as, and save the stylesheet window notebook somewhere. To make it available in the stylesheet choosing menu (Format | Stylesheet), save it in $UserBaseDirectory/SystemFiles/FrontEnd/StyleSheets, where $UserBaseDirectory is your user directory. If you don't know where that is, simply execute \$UserBaseDirectory in Mathematica and it will print its location. Once your newly created stylesheet is saved in that folder, you'll be able to select it over the menus; if it doesn't appear right away, restart the frontend.

If you want to use this as your default stylesheet, i.e. the one that is used when the program starts, go to the options inspector (Format | Options Inspector), select Global preferences at the top (see picture below), and change the value of DefaultStyleDefinitions to the path you put your stylesheet in.

-

Another option is to pull up the Format --> Option Inspector selection in the menu system, select the notebook that you're using in the upper-left, and then navigate to Notebook Options --> Display Options --> Background. The palette would let you pick the exact shade that you wish to work with. You can also see a bunch of the great options that R.M. identified in the answer above through the Option Inspector.

It's a little clunky and the SetOptions command is quicker, but it is an alternative for tinkering and playing around with to get the Notebook set up to your satisfaction.

-

This is just another way of getting at the notebook options, which I note as an alternative syntax to R.M.'s answer:

CurrentValue[EvaluationNotebook[], Background] = Red;


The CurrentValue command can also be used to access a range of other (often system-specific) options like "PanelFontSize".

-