Skip to content

pantoken / platforms/android/src / toAndroid

Funkcja: toAndroid()

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

Eksperymentalne

Wygeneruj plik XML zasobów Androida dla jawnego IR tokena.

Parametry

tokens

tylko do odczytu Token[]

options

GenerateAndroidOptions

Zwraca

Promise<string[]>

Ścieżki do zapisanych colors.xml i dimens.xml.

Przykłady

Wygeneruj IR dla konkretnego motywu

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

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