Skip to content

pantoken / formats/stylus/src / toStylus

Funksjon: toStylus()

toStylus(tokens, options?): string

Eksperimentell

Generer Stylus-variabler for en token-IR.

Parametere

tokens

skrivbeskyttet Token[]

IR-en (f.eks. fra @pantoken/tokens).

options?

ToStylusOptions = {}

ToStylusOptions.

Returnerer

string

Stylus-kildestrengen.

Eksempler

Generer de standard (lyse) variablene

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

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

Bestem mørk modus for et annet tema

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

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