Skip to content

pantoken-root / renderers/react-native/src / tokensForScheme

Funció: tokensForScheme() ​

tokensForScheme(scheme): Record<string, RNTokenValue>

Experimental

Seleccionar l'objecte de token per a un esquema de color (parella amb useColorScheme de RN).

Paràmetres ​

scheme ​

"light" | "dark" | null | undefined

Retorna ​

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