Skip to content

pantoken-root / platforms/android/src / toAndroid

Funció: toAndroid() ​

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

Experimental

Emeteri XML de recursos Android per a una IR de token explícita.

Paràmetres ​

tokens ​

només de lectura Token[]

options ​

GenerateAndroidOptions

Retorna ​

Promise<string[]>

Els camins dels colors.xml i dimens.xml escrits.

Exemples ​

Emeteri la IR d'un tema específic

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

Mode fosc amb VectorDrawables d'icones

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