Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Funkcja: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Eksperymentalne

Konwertuj listę tokenów IR na WordPressowy theme.json.

Parametry

tokens

tylko do odczytu Token[]

IR (np. z @pantoken/tokens).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Zwraca

ThemeJson

Dokument theme.json.

Przykłady

Konwertuj IR na theme.json w trybie jasnym

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

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

Tryb ciemny

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

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