Skip to content

pantoken / formats/stylus/src / toStylus

Funksjon: toStylus()

toStylus(tokens, options?): string

Eksperimentell

Generer Stylus-variablar for ein token IR.

Parametrar

tokens

skrivbeskytta Token[]

IR-en (til dømes frå @pantoken/tokens).

options?

ToStylusOptions = {}

ToStylusOptions.

Returnerer

string

Stylus-kildestrengen.

Døme

Generer standard (lys) variablar

ts
import { toStylus } from "@pantoken/stylus";
import { tokens } from "@pantoken/tokens";

toStylus(tokens); // "instui-color-brand = #0374b5\n…"

Løys mørk modus for eit anna tema

ts
import { toStylus } from "@pantoken/stylus";
import { byTheme } from "@pantoken/tokens";

toStylus(byTheme("canvas"), { mode: "dark" });