Files
ncd-fe/packages/pl-fe/src/hooks/use-theme.ts
marcin mikołajczak 2963504736 pl-fe: Rename files to kebab case
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-26 00:06:13 +02:00

18 lines
480 B
TypeScript

import { useSettings } from './use-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 };