Skip to content

pantoken / platforms/wordpress/src / toThemeJson

फंक्शन: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

प्रयोगात्मक

एक IR टोकन सूची को एक WordPress theme.json में बदलें।

पैरामीटर

tokens

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