Skip to content

pantoken / platforms/android/src / toAndroid

Funktion: toAndroid()

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

Experimentell

Android-Resource-XML für eine explizite Token-IR ausgeben.

Parameter

tokens

readonly Token[]

options

GenerateAndroidOptions

Rückgabe

Promise<string[]>

Die Pfade der geschriebenen colors.xml und dimens.xml.

Beispiele

Die IR eines bestimmten Themes ausgeben

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

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