useAppearance #

Follows the dark/light class on <html>, falling back to the operating system preference when neither class is present. Themes only need to toggle that class; components do not depend on a particular theme implementation.

Usage #

TypeScript
import { 
useAppearance
} from 'kawapress/client'
const {
isDark
} =
useAppearance
()
const
label
=
isDark
.
value
? 'Dark' : 'Light'

Returns The appearance of the page.

Notes #

Call it inside setup(). On the server it reports the configured appearance, and it follows the page once mounted.

Full type signature
TypeScript
function useAppearance(): Appearance

Edit this page

Comments