Skip to content

pantoken-root / platforms/wordpress/src / toThemeJson

Swyddogaeth: toThemeJson() ​

toThemeJson(tokens, options?): ThemeJson

Arbrofol

Trosi rhestr token IR yn theme.json ar gyfer WordPress.

Paramedrau ​

tokens ​

darllen-yn-unig Token[]

Yr IR (er enghraifft o @pantoken/tokens).

options? ​

ToThemeJsonOptions = {}

ToThemeJsonOptions.

Yn dychwelyd ​

ThemeJson

Dogfen theme.json.

Enghreifftiau ​

Trosi IR i theme.json mewn modd golau

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

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

Modd tywyll

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

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