2
$\begingroup$

To produce good color schemes for styling notebook I was used to generate a grid of controls

grid = {
   {Dynamic[background], 
    ColorSlider[Dynamic[background], ImageSize -> {800, 100}, 
     AppearanceElements -> "Spectrum"]},
   {Dynamic[fontColor], 
    ColorSlider[Dynamic[fontColor], ImageSize -> {800, 100}, 
     AppearanceElements -> "Spectrum"]},
   {Dynamic[cellframecolor], 
    ColorSlider[Dynamic[cellframecolor], ImageSize -> {800, 100}, 
     AppearanceElements -> "Spectrum"]}
   };
Grid @ grid

and print a cell whose options are manipulated through the previous sliders:

CellPrint[Cell["this", "Text"
   , CellFrame -> True
   , CellFrameColor -> Dynamic[cellframecolor]
   , Background -> Dynamic[background]
   , FontColor -> Dynamic[fontColor]
   ]
  ];

How can the same be achieved for the whole notebook's stylesheet, not for the specific cell ? I have not been capable to get it using CurrentValue[EvaluationNotebook[], "StyleDefinitions"].

$\endgroup$
6
  • $\begingroup$ Whatever you want to do, put them in stylesheet or just SetOptions[EvaluationNotebook[],...] keep in mind that cellframecolor will not survive through sessions and next time you open the notebook it will be broken. $\endgroup$
    – Kuba
    Feb 25, 2016 at 20:37
  • $\begingroup$ In How to put Magnification control in docked cell I have explained how to continuously change notebook's Magnification, you can do the same with other options. $\endgroup$
    – Kuba
    Feb 25, 2016 at 20:38
  • $\begingroup$ Hi! That cellframecolor get lost between sessions isn't an issue for the use I make of it: I can save as you explained yesterday in mathematica.stackexchange.com/questions/108266/…. My block is about CurrentValue: I have been experimenting with no result: please, can you provide a simple example to set, let's say, the background color for Title cells style ? $\endgroup$ Feb 25, 2016 at 20:47
  • $\begingroup$ Options for a notebook are ok, provided that I can save their values, to put them in a stylesheet by hand. $\endgroup$ Feb 25, 2016 at 20:56
  • $\begingroup$ Is this useful? mathematica.stackexchange.com/questions/7738/… $\endgroup$ Feb 25, 2016 at 21:08

2 Answers 2

2
$\begingroup$

Is this the sort of thing you are looking for?

enter image description here

If so possible duplicate.

$\endgroup$
1
  • $\begingroup$ Excellent reference: I'm going to read it in in detail. $\endgroup$ Feb 25, 2016 at 21:41
0
$\begingroup$

Is this what you need ? :

grid = {
   {Dynamic[background], 
    ColorSlider[Dynamic[background], ImageSize -> {800, 100}, 
     AppearanceElements -> "Spectrum"]},
   {Dynamic[fontColor], 
    ColorSlider[Dynamic[fontColor], ImageSize -> {800, 100}, 
     AppearanceElements -> "Spectrum"]},
   {Dynamic[cellframecolor], 
    ColorSlider[Dynamic[cellframecolor], ImageSize -> {800, 100}, 
     AppearanceElements -> "Spectrum"]}
   };

Grid @ grid

SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{
    Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
    Cell[StyleData["Text"], {
      CellFrame -> True,
      CellFrameColor -> Dynamic[cellframecolor],
      Background -> Dynamic[background],
      FontColor -> Dynamic[fontColor]}]}]]

 CellPrint[Cell["this", "Text"]]
 CellPrint[Cell["that", "Text"]]
$\endgroup$
1
  • $\begingroup$ Fits perfectly my needs. Thanks ! $\endgroup$ Feb 25, 2016 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.