Skip to content

pantoken / platforms/android/src / toAndroid

Funkcija: toAndroid()

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

Eksperimentalno

Ustvari Android resource XML za eksplicitni token IR.

Parametri

tokens

readonly Token[]

options

GenerateAndroidOptions

Vrne

Promise<string[]>

Poti do zapisanih colors.xml in dimens.xml.

Primeri

Ustvari IR za določeno temo

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

Temni način z ikonami 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
});