useDarkMode
Detect whether the preferred color mode of the system is dark.
API
function useDarkMode(): boolean;
Example
Is dark mode: false
import React from "react";
import { useDarkMode } from "@lilib/hooks";
function Example() {
const isDarkMode = useDarkMode();
return <>Is dark mode: {isDarkMode.toString()}</>;
}
export default Example;