Skip to content

pantoken / renderers/react-native/src / tokensForScheme

Fonction: tokensForScheme()

tokensForScheme(scheme): Record<string, RNTokenValue>

Expérimental

Sélectionnez l'objet de token pour un schéma de couleurs (associez-le au useColorScheme de RN).

Paramètres

scheme

"light" | "dark" | null | undefined

Renvoie

Record<string, RNTokenValue>

Exemple

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 } };