Skip to main content

Themes

theme accepts one Notebook Kit theme name.

import observablejs as obs

notebook = obs.Notebook(
obs.md("# Report"),
theme="glacier",
)

The default is "air". A light and dark mapping selects a theme for each browser color scheme.

notebook = obs.Notebook(
obs.md("# Report"),
theme={"light": "cotton", "dark": "slate"},
)

observablejs.NOTEBOOK_THEMES is a tuple containing the accepted names:

(
"air",
"coffee",
"cotton",
"deep-space",
"glacier",
"ink",
"midnight",
"near-midnight",
"ocean-floor",
"parchment",
"slate",
"stark",
"sun-faded",
)

Theme names are stripped and normalized to lowercase. Unknown names raise ValueError. Mappings must contain exactly light and dark, with a valid theme name for each value. Other value types raise TypeError.

Source-backed notebooks carry their theme in the <notebook theme="..."> attribute, including the light-dark(a, b) mapping form. Assigning notebook.theme on a source-backed notebook raises traitlets.TraitError. See Themes and pinned source.