Skip to content

pantoken / platforms/android/src / toAndroid

Funktion: toAndroid()

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

Eksperimentel

Udsend Android-ressource XML til en eksplicit token IR.

Parametre

tokens

skrivbeskyttet Token[]

options

GenerateAndroidOptions

Returnerer

Promise<string[]>

Stierne af de skrevne colors.xml og dimens.xml.

Eksempler

Udsend et specifikt temas 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

Mørk tilstand med icon 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
});