Lacspace
Loading
Dark / light / system
Adding dark / light / system theming to any React app — Next.js App Router included — with no flash of the wrong theme on first paint. A framework-agnostic next-themes alternative.
A tiny ThemeProvider (with a built-in no-flash script), a useTheme hook and getThemeScript(). Persists to storage, follows the OS, toggles a class or data-attribute — a framework-agnostic next-themes-lite.
$ npm install @lacspace/themeconst { theme, setTheme } = useTheme()<ThemeProvider …>defaultTheme, storageKey, themes, attribute, enableSystem, disableTransitionOnChange, enableNoFlashScript (built-in no-flash).useTheme()→ { theme, setTheme, resolvedTheme, systemTheme, themes }.getThemeScript(options?)Self-contained no-flash IIFE string (advanced; the provider injects one by default).