Skip to content

Themes

available_themes

available_themes() -> list[str]

Return a sorted list of every registered theme name.

Includes both the six built-in themes (default, clinical, jama, nejm, compact, minimal) and any user themes added via :func:register_theme. Apply a theme with :meth:~pysofra.SofraTable.theme.

Examples:

>>> import pysofra as ps
>>> ps.available_themes()
['clinical', 'compact', 'default', 'jama', 'minimal', 'nejm']

register_theme

register_theme(theme: Theme, *, overwrite: bool = False) -> None

Register a user-defined theme.

By default this refuses to overwrite a built-in theme; pass overwrite=True to force it. Overwriting an existing user theme is allowed without the flag — the guard exists only to keep ps.tbl_one(...).theme('clinical') from silently rendering with a user replacement that doesn't match what the documentation says.