Skip to content

pantoken / platforms/vanilla/src / toVanillaVariables

함수: toVanillaVariables()

toVanillaVariables(tokens, options?): Record<string, unknown>

실험적

IR 토큰 목록을 Vanilla Foundation variables.json 객체로 변환합니다.

매개변수

tokens

읽기 전용 Token[]

IR(예: @pantoken/tokens에서 온 것).

options?

ToVanillaOptions = {}

ToVanillaOptions.

반환값

Record<string, unknown>

테마의 variables.json 에셋에 PUT할 중첩된 변수 객체입니다.

예제들

IR을 중첩 변수 객체로 변환

ts
import { toVanillaVariables } from "@pantoken/vanilla";
import { byTheme } from "@pantoken/tokens";

const vars = toVanillaVariables(byTheme("rebrand"));
// { global: { mainColors: { primary: "#…" }, … }, titleBar: { … }, button: { … } }

다크 모드

ts
import { toVanillaVariables } from "@pantoken/vanilla";
import { byTheme } from "@pantoken/tokens";

const vars = toVanillaVariables(byTheme("canvas"), { mode: "dark" });