Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Függvény: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Kísérleti

Konvertálja az IR-tokenlistát WordPress theme.json formátumra.

Paraméterek

tokens

readonly Token[]

Az IR (pl. @pantoken/tokens-ből).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Visszatérés

ThemeJson

Egy theme.json dokumentum.

Példák

Konvertálja az IR-t light-mode theme.json fájllá

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

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

Sötét mód

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

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