Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Hàm: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Thử nghiệm

Chuyển danh sách token IR thành một theme.json cho WordPress.

Tham số

tokens

chỉ đọc Token[]

IR (ví dụ: từ @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Trả về

ThemeJson

Một tài liệu theme.json.

Các ví dụ

Chuyển IR thành theme.json chế độ sáng

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

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

Chế độ tối

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

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