pantoken / formats/stylus/src / toStylus
Function: toStylus()
toStylus(
tokens,options?):string
Experimental
Emit Stylus variables for a token IR.
Parameters
tokens
readonly Token[]
The IR (e.g. from @pantoken/tokens).
options?
ToStylusOptions = {}
Returns
string
The Stylus source string.
Examples
Emit the default (light) variables
ts
import { toStylus } from "@pantoken/stylus";
import { tokens } from "@pantoken/tokens";
toStylus(tokens); // "instui-color-brand = #0374b5\n…"Resolve the dark mode of another theme
ts
import { toStylus } from "@pantoken/stylus";
import { byTheme } from "@pantoken/tokens";
toStylus(byTheme("canvas"), { mode: "dark" });