Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Feidhm: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Turgnamhach

Tiontaigh liosta token IR go theme.json do WordPress.

Paraiméadair

tokens

neamh-inathraitheach Token[]

An IR (m.sh. ó @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Tuairisceáin

ThemeJson

Doiciméad theme.json.

Samplaí

Tiontaigh IR go theme.json i mód éadrom

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 dorcha

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

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