ba9e4a5add
- _layout: replace invalid SFSymbols7_0 name "calendar.fill" with "calendar.circle.fill" (the fill variant of calendar in SF Symbols) - useColors: remove unsafe cast through Record<string, palette> — colors.radius (number) is incompatible with the palette shape; simplify to a direct ternary since both light and dark palettes are always defined Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
766 B
TypeScript
22 lines
766 B
TypeScript
import { useColorScheme } from "react-native";
|
|
|
|
import colors from "@/constants/colors";
|
|
|
|
/**
|
|
* Returns the design tokens for the current color scheme.
|
|
*
|
|
* The returned object contains all color tokens for the active palette
|
|
* plus scheme-independent values like `radius`.
|
|
*
|
|
* Falls back to the light palette when no dark key is defined in
|
|
* constants/colors.ts (the scaffold ships light-only by default).
|
|
* When a sibling web artifact's dark tokens are synced into a `dark`
|
|
* key, this hook will automatically switch palettes based on the
|
|
* device's appearance setting.
|
|
*/
|
|
export function useColors() {
|
|
const scheme = useColorScheme();
|
|
const palette = scheme === "dark" ? colors.dark : colors.light;
|
|
return { ...palette, radius: colors.radius };
|
|
}
|