pysepal.solara.theme.ThemeState#
- class pysepal.solara.theme.ThemeState(*args, **kwargs)[source]#
Session-scoped theme preference and resolved dark/light state.
Initialize with an initial mode and optional explicit dark value.
Attributes
darkA boolean (True, False) trait.
modeAn enum whose value must be in a given sequence.
Methods
Initialize with an initial mode and optional explicit dark value.
Map theme mode to ThemeToggle.dark semantics.
Update the effective dark/light value.
Update theme preference and keep fixed modes aligned with dark.
Map ThemeToggle.dark semantics back to theme mode.
- Parameters:
mode (str)
dark (Optional[bool])
- ThemeState.__init__(mode='auto', dark=None, **kwargs)[source]#
Initialize with an initial mode and optional explicit dark value.
- Parameters:
mode (str)
dark (bool | None)
- static ThemeState.mode_to_widget_dark(mode)[source]#
Map theme mode to ThemeToggle.dark semantics.
- Parameters:
mode (str)
- Return type:
bool | None
- ThemeState.set_dark(dark)[source]#
Update the effective dark/light value.
- Parameters:
dark (bool)
- Return type:
None