Skip to content

pantoken-root / formats/stylus/src / toStylus

Funktion: toStylus() ​

toStylus(tokens, options?): string

Experimentell

Generera Stylus-variabler för ett token-IR.

Parametrar ​

tokens ​

skrivskyddad Token[]

IR:n (t.ex. från @pantoken/tokens).

options? ​

ToStylusOptions = {}

ToStylusOptions.

Returnerar ​

string

Källsträngen för Stylus.

Exempel ​

Generera standardvariablerna (ljusa)

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

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

Bestäm mörkt läge för ett annat tema

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

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