Skip to content

pantoken-root / 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 } };