Skip to content

pantoken / platforms/wordpress/src / toThemeJson

함수: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

실험적

IR 토큰 목록을 WordPress theme.json로 변환합니다.

매개변수

tokens

읽기 전용 Token[]

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

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

반환값

ThemeJson

하나의 theme.json 문서입니다.

예제들

IR을 라이트 모드 theme.json으로 변환합니다

ts
import { toThemeJson } from "@pantoken/wordpress";
import { byTheme } from "@pantoken/tokens";

const doc = toThemeJson(byTheme("rebrand"));
doc.settings.color.palette; // [{ slug, name, color }, …]

다크 모드

ts
import { toThemeJson } from "@pantoken/wordpress";
import { byTheme } from "@pantoken/tokens";

const doc = toThemeJson(byTheme("canvas"), { mode: "dark" });