Skip to content

pantoken / formats/stylus/src / toStylus

Funktion: toStylus()

toStylus(tokens, options?): string

Experimentell

Gibt Stylus-Variablen für eine Token-IR aus.

Parameter

tokens

readonly Token[]

Das IR (z. B. von @pantoken/tokens).

options?

ToStylusOptions = {}

ToStylusOptions.

Rückgabe

string

Die Stylus-Quellzeichenfolge.

Beispiele

Standard-(helle) Variablen ausgeben

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

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

Löse den Dunkelmodus eines anderen Themas auf

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

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