this repo has no description
at main 536 B view raw
1/** 2 * Learn more about light and dark modes: 3 * https://docs.expo.dev/guides/color-schemes/ 4 */ 5 6import { Colors } from '@/constants/Colors'; 7import { useColorScheme } from '@/hooks/useColorScheme'; 8 9export function useThemeColor( 10 props: { light?: string; dark?: string }, 11 colorName: keyof typeof Colors.light & keyof typeof Colors.dark 12) { 13 const theme = useColorScheme() ?? 'light'; 14 const colorFromProps = props[theme]; 15 16 if (colorFromProps) { 17 return colorFromProps; 18 } else { 19 return Colors[theme][colorName]; 20 } 21}