Skip to content

pantoken / formats/stylus/src / toStylus

Functie: toStylus()

toStylus(tokens, options?): string

Experimenteel

Genereer Stylus-variabelen voor een token-IR.

Parameters

tokens

alleen-lezen Token[]

De IR (bijvoorbeeld van @pantoken/tokens).

options?

ToStylusOptions = {}

ToStylusOptions.

Retourneert

string

De Stylus-brontekst.

Voorbeelden

Genereer de standaard (lichte) variabelen

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

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

Bepaal de donkere modus van een ander thema

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

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