web / lib/hooks/use-theme
lib/hooks/use-theme
This file contains a custom React hook for managing the application’s theme.
The useTheme hook is responsible for:
- Reading the current theme (light, dark, or system) from the Zustand store.
- Applying the correct theme class to the
<html>element. - Listening for changes in the user’s operating system theme preference when the “system” theme is selected, and automatically updating the UI to match.
Functions
useTheme()
useTheme():
object
Returns
object
theme
theme:
"system"|"light"|"dark"
setTheme()
setTheme: (
theme) =>void
Parameters
theme
"system" | "light" | "dark"
Returns
void
resolvedTheme
resolvedTheme:
"light"|"dark"
Last updated on