Skip to content

pantoken / platforms/android/src / toAndroid

함수: toAndroid()

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

실험적

명시적 토큰 IR을 위한 Android 리소스 XML을 생성합니다.

매개변수

tokens

읽기 전용 Token[]

options

GenerateAndroidOptions

반환값

Promise<string[]>

작성된 colors.xmldimens.xml의 경로들.

예제들

특정 테마의 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

아이콘 VectorDrawable을 사용하는 다크 모드

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