4
$\begingroup$

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!

$\endgroup$
4
$\begingroup$
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[])

$\endgroup$
  • 3
    $\begingroup$ This is very poorly documented. Can't find anything neither comprehensive nor concise. Only pieces of informations. $\endgroup$ – andre314 Jan 16 '16 at 22:47
  • $\begingroup$ 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 ? $\endgroup$ – mitochondrial Jan 17 '16 at 4:41
  • 1
    $\begingroup$ @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. $\endgroup$ – andre314 Jan 17 '16 at 9:33

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.