Skip to content

pantoken-root / platforms/wordpress/src / toThemeJson

Fonksyon: toThemeJson() ​

toThemeJson(tokens, options?): ThemeJson

Eksperimantal

Konvèti yon lis tokèn IR an yon WordPress theme.json.

Paramèt ​

tokens ​

sèlman lekti Token[]

IR la (pa egzanp soti nan @pantoken/tokens).

options? ​

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Retounen ​

ThemeJson

Yon dokiman theme.json.

Egzanp ​

Konvèti yon IR an yon theme.json pou mòd limyè

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

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

Mòd fènwa

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

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