This commit is contained in:
Saeed Vaziry
2025-06-04 08:08:20 +02:00
parent efacadba10
commit c3f69f3247
114 changed files with 4032 additions and 765 deletions

View File

@ -62,6 +62,14 @@ export function useAppearance() {
applyTheme(mode);
}, []);
// create a method to return the actual appearance light or dark
const getActualAppearance = useCallback(() => {
if (appearance === 'system') {
return prefersDark() ? 'dark' : 'light';
}
return appearance;
}, [appearance]);
useEffect(() => {
const savedAppearance = localStorage.getItem('appearance') as Appearance | null;
updateAppearance(savedAppearance || 'system');
@ -69,5 +77,5 @@ export function useAppearance() {
return () => mediaQuery()?.removeEventListener('change', handleSystemThemeChange);
}, [updateAppearance]);
return { appearance, updateAppearance } as const;
return { appearance, updateAppearance, getActualAppearance } as const;
}