Skip to content

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

تابع: tokensForScheme() ​

tokensForScheme(scheme): Record<string, RNTokenValue>

تجربی

شیء توکن مربوط به یک طرح رنگ را انتخاب کنید (با 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 } };