Skip to content

pantoken / platforms/vanilla/src / toVanillaVariables

Mahi: toVanillaVariables()

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

Whakamātautau

Tāhuri he rārangi tohu IR kia tū hei tūnga variables.json o Vanilla Foundation.

Ngā Tawhā

tokens

panui-anake Token[]

Te IR (hei tauira, nō @pantoken/tokens).

options?

ToVanillaOptions = {}

ToVanillaOptions.

Whakahokia

Record<string, unknown>

Te tūnga huanga ā-roto hei PUT ki te rawa variables.json o te kaupapa.

Ngā tauira

Tāhuri te IR ki te tūnga huanga ā-roto

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

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

Aratau pōuri

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

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