Skip to content

pantoken-root / platforms/wordpress/src / toThemeJson

Funkcija: toThemeJson() ​

toThemeJson(tokens, options?): ThemeJson

Eksperimentalno

Pretvori seznam tokenov IR v WordPress theme.json.

Parametri ​

tokens ​

samo za branje Token[]

IR (npr. iz @pantoken/tokens).

options? ​

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Vrne ​

ThemeJson

Dokument theme.json.

Primeri ​

Pretvori IR v theme.json za svetel način

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

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

Temni način

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

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