Files
ncd-fe/packages/pl-fe/src/hooks/use-theme.ts
nicole mikołajczyk ec298b1294 pl-fe: zustand improvements
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2025-10-22 21:58:05 +02:00

19 lines
500 B
TypeScript

import { useSettings } from 'pl-fe/stores/settings';
import { useSystemTheme } from './use-system-theme';
type Theme = 'light' | 'dark' | 'black';
/**
* Returns the actual theme being displayed (eg "light" or "dark")
* regardless of whether that's by system theme or direct setting.
*/
const useTheme = (): Theme => {
const { themeMode } = useSettings();
const systemTheme = useSystemTheme();
return themeMode === 'system' ? systemTheme : themeMode;
};
export { useTheme, type Theme };