Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Función: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Experimental

Convertir una lista de tokens IR en un theme.json de WordPress.

Parámetros

tokens

solo lectura Token[]

El IR (p. ej. de @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Devuelve

ThemeJson

Un documento theme.json.

Ejemplos

Convertir un IR a un theme.json para modo claro

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

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

Modo oscuro

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

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