eletrotupi / tcc/ frontend/hooks/use-theme-color.tsdcee93d0c11ceff985805b7785c7db54c2acc4dd
490 B | 21 lines Raw
1
/**
2
 * Learn more about light and dark modes:
3
 * https://docs.expo.dev/guides/color-schemes/
4
 */
5

6
import { Colors } from '@/constants/theme';
7
import { useColorScheme } from '@/hooks/use-color-scheme';
8

9
export function useThemeColor(
10
  props: { light?: string; dark?: string },
11
  colorName: keyof typeof Colors.light
12
) {
13
  const theme = 'light';
14
  const colorFromProps = props[theme];
15

16
  if (colorFromProps) {
17
    return colorFromProps;
18
  } else {
19
    return Colors[theme][colorName];
20
  }
21
}