Skip to content

pantoken / formats/stylus/src / toStylus

Funció: toStylus()

toStylus(tokens, options?): string

Experimental

Emetera variables Stylus per a un token IR.

Paràmetres

tokens

només de lectura Token[]

La IR (p. ex. de @pantoken/tokens).

options?

ToStylusOptions = {}

ToStylusOptions.

Retorna

string

La cadena de font Stylus.

Exemples

Emetre les variables per defecte (clares)

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

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

Resol el mode fosc d'un altre tema

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

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