# programmatically styling notebook

A notebook's background can be changed simply by

SetOptions[EvaluationNotebook[], Background -> GrayLevel[.9]];


What is the command to set, let's say, the background color of all Section cells, that is, to programmatically edit stylesheets ?

Thanks!

SetOptions[EvaluationNotebook[],
StyleDefinitions ->
Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]],
Cell[StyleData["Section"], Background -> Yellow]}]]


Code extracted from this question.

It doesn't edit the style sheet (I mean the file "default.nb") but add new style informations that are saved in the current notebook (the EvaluationNotebook[])

• This is very poorly documented. Can't find anything neither comprehensive nor concise. Only pieces of informations. – andre314 Jan 16 '16 at 22:47
• Thanks for your reply! It seems exactly what I was looking for. The options I can set are all those listed by 'Cell // Options // Sort // TableForm', are they ? – mitochondrial Jan 17 '16 at 4:41
• @mitochondrial I think that all options listed by Cell // Options can be set in this way. Maybe there are other options. Personally, I sometimes use the options inspector to find and set the proper option interactively, and then I insert it in my code. – andre314 Jan 17 '16 at 9:33