Skip to content

pantoken-root / platforms/android/src / toAndroid

Funktio: toAndroid() ​

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

Kokeellinen

Tuota Android-resurssi-XML eksplisiittiselle token IR:lle.

Parametrit ​

tokens ​

vain-luku Token[]

options ​

GenerateAndroidOptions

Palauttaa ​

Promise<string[]>

Kirjoitettujen colors.xml- ja dimens.xml-polut.

Esimerkit ​

Tuota tietyn teeman 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

Tumma tila, jossa on kuvakkeet 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
});