Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/netzo/deps/usehooks-ts.ts>useDarkMode

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useDarkMode
Deprecated
Deprecated

this useDarkMode's signature is deprecated, it now accepts an options object instead of multiple parameters.

import { useDarkMode } from "https://deno.land/x/netzo@0.5.66/deps/usehooks-ts.ts";

Custom hook that returns the current state of the dark mode.

Examples

const { isDarkMode, toggle, enable, disable, set } = useDarkMode(false, 'my-key');

Parameters

defaultValue: boolean

the initial value of the dark mode, default false.

optional
localStorageKey: string

the key to use in the local storage, default 'usehooks-ts-dark-mode'.

Returns

DarkModeOutput

An object containing the dark mode's state and its controllers.