Function Repository Resource:

SetContextStyle

Source Notebook

Set the auto-style options for a given context

Contributed by: Richard Hennigan (Wolfram Research)

ResourceFunction["SetContextStyle"][style]

sets the auto-style options for the current notebook and current context to style.

ResourceFunction["SetContextStyle"][context,style]

sets the auto-style options for the current notebook and context to style.

ResourceFunction["SetContextStyle"][nb,context,style]

sets the auto-style options for context to style in the notebook nb.

Examples

Basic Examples (1) 

Use the function:

In[1]:=
ResourceFunction["SetContextStyle"][Orange]
Out[1]=

Scope (3) 

Retrieve the ResourceFunction:

In[2]:=
ResourceFunction["SetContextStyle"]
Out[2]=

Retrieve the ResourceObject:

In[3]:=
ResourceObject["SetContextStyle"]
Out[3]=

Use Automatic to clear previously defined styles:

In[4]:=
ResourceFunction["SetContextStyle"][Automatic]
Out[4]=

Set the style for a particular context:

In[5]:=
ResourceFunction["SetContextStyle"][
  "MyContext`", {Green, FontFamily -> "Comic Sans MS"}];
MyContext`test;

Set the style in a particular notebook:

In[6]:=
nb = NotebookPut[
   Notebook[{Cell[BoxData["MyContext`test"], "Input"]}, WindowSize -> {400, 200}]];
ResourceFunction["SetContextStyle"][nb, "MyContext`", {Blue, FontSize -> 24}];
Rasterize[nb]
Out[6]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 15 August 2018

License Information