Mobile App design
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { useColorScheme } from 'react-native';
|
||||
import { colors, darkColors } from '../constants/theme';
|
||||
import { useThemeStore, ThemeMode } from '../store/themeStore';
|
||||
|
||||
export type AppColors = typeof colors;
|
||||
|
||||
export function useThemeColor(): { colors: AppColors; isDark: boolean; mode: ThemeMode } {
|
||||
const systemScheme = useColorScheme();
|
||||
const mode = useThemeStore((s) => s.mode);
|
||||
|
||||
const isDark =
|
||||
mode === 'dark' || (mode === 'system' && systemScheme === 'dark');
|
||||
|
||||
return {
|
||||
colors: isDark ? darkColors : colors,
|
||||
isDark,
|
||||
mode,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user