initial commit

This commit is contained in:
Hunter
2026-11-01 13:23:44 -05:00
commit e03ea4f770
53 changed files with 10802 additions and 0 deletions

20
lib/useSystemDark.ts Normal file
View File

@@ -0,0 +1,20 @@
"use client";
import { useSyncExternalStore } from "react";
const QUERY = "(prefers-color-scheme: dark)";
function subscribe(onChange: () => void): () => void {
const mq = window.matchMedia(QUERY);
mq.addEventListener("change", onChange);
return () => mq.removeEventListener("change", onChange);
}
/** Whether the OS is in dark mode (false during SSR). */
export function useSystemDark(): boolean {
return useSyncExternalStore(
subscribe,
() => window.matchMedia(QUERY).matches,
() => false
);
}