API Reference

Theme helpers

sphinx_gp_theme.get_theme_path()
function[source]
function[source]
sphinx_gp_theme.get_theme_path()

Return the path to the sphinx-gp-theme theme directory.

Returns:

Absolute path to the theme directory containing theme.conf and associated templates/static files.

Return type:

pathlib.Path

Examples

>>> theme_path = get_theme_path()
>>> (theme_path / "theme.conf").exists()
True
>>> (theme_path / "static" / "css" / "custom.css").exists()
True
sphinx_gp_theme.setup(app)
function[source]
function[source]
sphinx_gp_theme.setup(app)

Register the bundled theme with Sphinx.

Parameters:

app (Sphinx) – The Sphinx application object.

Returns:

Extension metadata for Sphinx.

Return type:

dict[str, bool | str]

Examples

>>> class FakeApp:
...     def __init__(self) -> None:
...         self.calls: list[tuple[str, pathlib.Path]] = []
...     def add_html_theme(self, name: str, theme_path: pathlib.Path) -> None:
...         self.calls.append((name, theme_path))
>>> fake = FakeApp()
>>> metadata = setup(fake)  # type: ignore[arg-type]
>>> fake.calls[0][0]
'sphinx-gp-theme'
>>> metadata["parallel_read_safe"]
True

Pygments style

class sphinx_gp_theme.pygments_styles.GpSphinxLightStyle
class sphinx_gp_theme.pygments_styles.GpSphinxLightStyle

Bases: Style

Light Pygments style mirroring the Microviz CodeMirror light palette.

The token-to-color mapping follows the OKLCH-derived palette used by the CodeMirror editor in social-embed and microviz: slate-900 text on a slate-50 background, with purple keywords, yellow strings, blue numbers, orange built-ins, red HTML tags, and slate-500 italic comments.

Examples

>>> GpSphinxLightStyle.name
'gp-sphinx-light'
>>> GpSphinxLightStyle.background_color
'#f8fafc'
>>> GpSphinxLightStyle.styles[token.Keyword]
'bold #7c3aed'
>>> GpSphinxLightStyle.styles[token.String]
'#ca8a04'
>>> GpSphinxLightStyle.styles[token.Comment]
'italic #64748b'