ui/client/features/shell/hooks/useTheme
Cockpit client (features), next. Source: ui/client/features/shell/hooks/useTheme.tsx.
Functions#
useTheme()#
useTheme():
object
Defined in: ui/client/features/shell/hooks/useTheme.tsx:14
Current theme, the person's preference (Dark / Light / System) and the actions to change it. The initial values are 'dark' for SSR/hydration parity; the stored preference is read right after mount (the inline init script in the document head has already applied it, so there is no flash). is the resolved source of truth. While the preference is "system", a change of the operating system's own setting is followed live.
Returns#
preference
preference:
ThemePreference
setPreference
setPreference: (
next) =>void
Parameters
next
Returns
void
theme
theme:
Theme
toggle
toggle: () =>
void
The palette's "Toggle dark / light theme": flips what is painted and pins it as an explicit choice.
Returns
void