pysepal.solara.theme.get_current_theme_state#

pysepal.solara.theme.get_current_theme_state()[source]#

Return the theme state for the current runtime scope.

Theme is UI state, not session state: it is created on first access, so a Solara connection, a Voila page, plain Jupyter, a script and pytest all get a real ThemeState. There is no session lookup and no credential in this path, and this function never raises.

The state belongs to the kernel that first read it and is released with it. That lifetime is the point: a ThemeState retains every widget observing its traitlets, so one kept past its connection keeps that connection’s map alive. Outside a Solara server there is one kernel per process.

A fresh state starts at mode="auto"; it is no longer seeded from ~/.sepal-ui-config, which is process-global and therefore leaked one user’s theme into every other session (issue #977).

Return type:

ThemeState