summaryrefslogtreecommitdiffstats
path: root/hooks/use-theme-color.ts
diff options
context:
space:
mode:
authorjciespuertodelacruz <jc.iespuertodelacruz@gmx.es>2026-01-20 08:49:52 +0000
committerjciespuertodelacruz <jc.iespuertodelacruz@gmx.es>2026-01-20 08:49:52 +0000
commitc6f2b6f85d151d6d2a2cc68eb05edd7a1e448106 (patch)
tree1080219bee426d5d1372da6c31f138482c1544d7 /hooks/use-theme-color.ts
Initial commit
Generated by create-expo-app 3.5.3.
Diffstat (limited to 'hooks/use-theme-color.ts')
-rw-r--r--hooks/use-theme-color.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/hooks/use-theme-color.ts b/hooks/use-theme-color.ts
new file mode 100644
index 0000000..0cbc3a6
--- /dev/null
+++ b/hooks/use-theme-color.ts
@@ -0,0 +1,21 @@
+/**
+ * Learn more about light and dark modes:
+ * https://docs.expo.dev/guides/color-schemes/
+ */
+
+import { Colors } from '@/constants/theme';
+import { useColorScheme } from '@/hooks/use-color-scheme';
+
+export function useThemeColor(
+ props: { light?: string; dark?: string },
+ colorName: keyof typeof Colors.light & keyof typeof Colors.dark
+) {
+ const theme = useColorScheme() ?? 'light';
+ const colorFromProps = props[theme];
+
+ if (colorFromProps) {
+ return colorFromProps;
+ } else {
+ return Colors[theme][colorName];
+ }
+}