Skip to content

pantoken / platforms/android/src / toAndroid

Fonction: toAndroid()

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

Expérimental

Générer le XML de ressources Android pour un IR de jeton explicite.

Paramètres

tokens

lecture seule Token[]

options

GenerateAndroidOptions

Renvoie

Promise<string[]>

Les chemins des fichiers colors.xml et dimens.xml écrits.

Exemples

Générer l'IR d'un thème spécifique

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 sombre avec des VectorDrawables d'icônes

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