Skip to content

pantoken-root / platforms/android/src / toAndroid

تابع: toAndroid() ​

toAndroid(tokens, options): Promise<string[]>

تجربی

تولید XML منابع اندروید برای یک IR صریحِ توکن.

پارامترها ​

tokens ​

فقط‌خواندنی Token[]

options ​

GenerateAndroidOptions

مقدار بازگشتی ​

Promise<string[]>

مسیرهای فایل‌های نوشته‌شده colors.xml و dimens.xml.

نمونه‌ها ​

تولید IRِ تم مشخص

ts
import { toAndroid } from "@pantoken/android";
import { byTheme } from "@pantoken/tokens";

const [colors, dimens] = await toAndroid(byTheme("canvas"), { outDir: "./app/src/main" });
// writes ./app/src/main/res/values/colors.xml and dimens.xml

حالت تیره با آیکون‌های VectorDrawables

ts
import { toAndroid } from "@pantoken/android";
import { byTheme } from "@pantoken/tokens";

await toAndroid(byTheme("rebrand"), {
  outDir: "./app/src/main",
  mode: "dark",
  icons: ["add", "check"], // also emits res/drawable/ic_add.xml, ic_check.xml
});