Wolfram Research

SetContextStyle

Contributed by: Richard Hennigan (Wolfram Research)

Sets the auto style options for a given context

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

Use the function:

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

More Examples

Scope

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]=

Resource History