Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
/**
* Learn more about light and dark modes:
* https://docs.expo.dev/guides/color-schemes/
*/
import { useColorScheme } from '@/hooks/useColorScheme';
import { Colors } from '@/constants/Colors';
/**
* Get the color for the current theme.
*
* @param props - The props to get the color from.
* @param colorName - The name of the color to get.
* @returns The color for the current theme.
*/
export function useThemeColor(
props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
) : string {
const theme = useColorScheme() ?? 'light';
const colorFromProps = props[theme];
if (colorFromProps) {
return colorFromProps;
} else {
return Colors[theme][colorName];
}
}