pantoken / packages/core/src / defineToken
Function: defineToken()
defineToken(
input):Token
Beta
Build a fully-formed Token from partial input, defaulting inherits and syntax.
Parameters
input
Returns
Examples
Sniff syntax from a concrete value
ts
import { defineToken } from "@pantoken/core";
defineToken({ name: "--instui-color-x", value: "#0374B5" });
// → { name: "--instui-color-x", syntax: "<color>", inherits: true, value: "#0374B5" }A single var() value records refersTo; a light-dark() sets themed
ts
import { defineToken } from "@pantoken/core";
defineToken({ name: "--instui-brand", value: "var(--instui-color-background-brand)" });
// → syntax "*", refersTo: "--instui-color-background-brand"
defineToken({ name: "--instui-bg", value: "light-dark(#fff, #000)" });
// → syntax "*", themed: true