Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Functie: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Experimenteel

Converteer een IR-tokenlijst naar een WordPress theme.json.

Parameters

tokens

alleen-lezen Token[]

De IR (bijvoorbeeld van @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Retourneert

ThemeJson

Een theme.json-document.

Voorbeelden

Converteer een IR naar een 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 }, …]

Donkere modus

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

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