Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Fall: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Tilrauna

Breyta IR táknalista í WordPress theme.json.

Færibreytur

tokens

readonly Token[]

IR-ið (t.d. frá @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Skilar

ThemeJson

Skjal af gerðinni theme.json.

Dæmi

Breyta IR í theme.json fyrir ljósan hátt

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

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

Dökkur hamur

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

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