Skip to content

pantoken / renderers/react-native/src / tokensForScheme

Συνάρτηση: tokensForScheme()

tokensForScheme(scheme): Record<string, RNTokenValue>

Πειραματικό

Επιλέξτε το αντικείμενο token για ένα χρωματικό σχήμα (ταιριάξτε το με το useColorScheme του RN).

Παράμετροι

scheme

"light" | "dark" | null | undefined

Επιστρέφει

Record<string, RNTokenValue>

Παράδειγμα

tsx
import { useColorScheme } from "react-native";
import { tokensForScheme } from "@pantoken/react-native";

const t = tokensForScheme(useColorScheme());
const styles = { card: { backgroundColor: t.colorBackgroundBase, padding: t.spacingSpaceMd } };