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