mirror of
https://github.com/DocNR/POWR.git
synced 2025-04-23 01:01:27 +00:00
17 lines
517 B
TypeScript
17 lines
517 B
TypeScript
// hooks/useThemeColor.ts
|
|
import { Colors } from '@/constants/Colors';
|
|
import { useColorScheme } from '@/hooks/useColorScheme';
|
|
import { ColorScheme } from '@/types/theme';
|
|
|
|
export function useThemeColor(
|
|
props: { light?: string; dark?: string },
|
|
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
|
|
) {
|
|
const { colorScheme } = useColorScheme();
|
|
const themeColor = colorScheme as ColorScheme;
|
|
|
|
if (props[themeColor]) {
|
|
return props[themeColor];
|
|
}
|
|
return Colors[themeColor][colorName];
|
|
} |