Skip to content

pantoken-root / platforms/wordpress/src / toThemeJson

دالة: toThemeJson() ​

toThemeJson(tokens, options?): ThemeJson

Experimental

حوّل قائمة رموز IR إلى theme.json لِـ WordPress.

Parameters ​

tokens ​

للقراءة فقط Token[]

IR (مثلاً من @pantoken/tokens).

options? ​

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Returns ​

ThemeJson

مستند theme.json.

Examples ​

حوّل 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" });