import { useTheme } from 'react-native-paper'; import { lightTheme, darkTheme } from '@/constants/Colors'; export function useThemeColor( props: { light?: string; dark?: string }, colorName?: keyof typeof lightTheme & keyof typeof darkTheme ) { const theme = useTheme(); const colorScheme = theme.dark ? 'dark' : 'light'; const colorFromProps = props[colorScheme]; if (colorFromProps) { return colorFromProps; } else if (colorName) { return theme[colorName]; } else { return theme.colors.onSurface; // fallback } }