MCPcopy Create free account
hub / github.com/code100x/mobile-magic / useThemeColor

Function useThemeColor

expo-base-app/hooks/useThemeColor.ts:9–21  ·  view source on GitHub ↗
(
  props: { light?: string; dark?: string },
  colorName: keyof typeof Colors.light & keyof typeof Colors.dark
)

Source from the content-addressed store, hash-verified

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}

Callers 2

ThemedTextFunction · 0.90
ThemedViewFunction · 0.90

Calls 1

useColorSchemeFunction · 0.90

Tested by

no test coverage detected