Skip to content

pantoken / packages/core/src / defineToken

Swyddogaeth: defineToken()

defineToken(input): Token

Bêta

Adeiladu Token wedi'i ffurfio'n llawn o fewnbwn rhannol, gan roi inherits a syntax fel diofyn.

Paramedrau

input

TokenInput

Yn dychwelyd

Token

Enghreifftiau

Canfod sintacs o werth pendant

ts
import { defineToken } from "@pantoken/core";

defineToken({ name: "--instui-color-x", value: "#0374B5" });
// → { name: "--instui-color-x", syntax: "<color>", inherits: true, value: "#0374B5" }

Mae un gwerth var() yn cofnodi refersTo; mae light-dark() yn gosod 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