Skip to content

pantoken / renderers/react-native/src / tokensForScheme

Hàm: tokensForScheme()

tokensForScheme(scheme): Record<string, RNTokenValue>

Thử nghiệm

Chọn đối tượng token cho một sơ đồ màu (kết hợp với useColorScheme của RN).

Tham số

scheme

"light" | "dark" | null | undefined

Trả về

Record<string, RNTokenValue>

Ví dụ

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