Skip to content

pantoken / platforms/android/src / toAndroid

Ֆունկցիա: toAndroid()

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

Փորձարկումային

Արտահանել Android ռեսուրսների XML՝ հստակ token 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
});