Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Funktio: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Kokeellinen

Muunna IR-tunnuslista WordPress theme.json:ksi.

Parametrit

tokens

vain-luku Token[]

IR (esim. peräisin @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Palauttaa

ThemeJson

theme.json-dokumentti.

Esimerkit

Muunna IR vaalean tilan theme.json:ksi

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

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

Tumma tila

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

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