Skip to content

pantoken / platforms/vanilla/src / toVanillaVariables

Swyddogaeth: toVanillaVariables()

toVanillaVariables(tokens, options?): Record<string, unknown>

Arbrofol

Trosi rhestr tokenau IR yn wrthrych variables.json ar gyfer Vanilla Foundation.

Paramedrau

tokens

darllen-yn-unig Token[]

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

options?

ToVanillaOptions = {}

ToVanillaOptions.

Yn dychwelyd

Record<string, unknown>

Y gwrthrych newidynnau wedi'i nestio i'w PUT i ased variables.json y thema.

Enghreifftiau

Trosi IR i'r gwrthrych newidynnau wedi'i nestio

ts
import { toVanillaVariables } from "@pantoken/vanilla";
import { byTheme } from "@pantoken/tokens";

const vars = toVanillaVariables(byTheme("rebrand"));
// { global: { mainColors: { primary: "#…" }, … }, titleBar: { … }, button: { … } }

Modd tywyll

ts
import { toVanillaVariables } from "@pantoken/vanilla";
import { byTheme } from "@pantoken/tokens";

const vars = toVanillaVariables(byTheme("canvas"), { mode: "dark" });