Skip to main content

Appearance

Appearance exposes information about the preferred color scheme (light or dark).

Types​

t​

type t = [#dark | #light]

Returned from getColorScheme / useColorScheme as option<t> (None when no preference is available).

Appearance.getColorScheme() == Some(#dark)

Methods​

getColorScheme​

Query the current preferred color scheme. Note that the preference may be updated later, either through user action or automatically.

getColorScheme: unit => option<t>

useColorScheme​

Query the current preferred color scheme and subscribe to updates (React hook).

useColorScheme: unit => option<t>

setColorScheme​

Force the app color scheme.

setColorScheme: t => unit

addChangeListener​

Subscribe to appearance changes. Returns an EventSubscription.

addChangeListener: (unit => unit) => EventSubscription.t