18 lines
480 B
TypeScript
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 };
|