Skip to content

pantoken / platforms/wordpress/src / toThemeJson

Fonksiyon: toThemeJson()

toThemeJson(tokens, options?): ThemeJson

Deneysel

Bir IR token listesini bir WordPress theme.json'e dönüştür.

Parametreler

tokens

salt okunur Token[]

IR (ör. @pantoken/tokens'den).

options?

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Döndürür

ThemeJson

Bir theme.json belgesi.

Örnekler

Bir IR'i light-mode theme.json dosyasına dönüştür

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

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

Karanlık mod

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

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