2024.5.0 (#39)

This commit is contained in:
Gregory Schier
2024-06-03 14:08:24 -07:00
committed by GitHub
parent 60e469a1c9
commit 4f9a7e9c88
197 changed files with 12283 additions and 3505 deletions
+18
View File
@@ -0,0 +1,18 @@
import { useEffect, useState } from 'react';
import {
getCSSAppearance,
getWindowAppearance,
subscribeToWindowAppearanceChange,
} from '../lib/theme/appearance';
import { type Appearance } from '../lib/theme/window';
export function usePreferredAppearance() {
const [preferredAppearance, setPreferredAppearance] = useState<Appearance>(getCSSAppearance());
useEffect(() => {
getWindowAppearance().then(setPreferredAppearance);
return subscribeToWindowAppearanceChange(setPreferredAppearance);
}, []);
return preferredAppearance;
}