Skip to content

pantoken / renderers/react-native/src / tokensForScheme

関数: tokensForScheme()

tokensForScheme(scheme): Record<string, RNTokenValue>

実験的

配色スキームのトークンオブジェクトを選択します(RNのuseColorSchemeと組み合わせて使用)。

パラメーター

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