Skip to content

pantoken-root / 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-ը վերածել light-mode 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" });