Skip to content

pantoken / packages/core/src / defineToken

Mahi: defineToken()

defineToken(input): Token

Beta

Hangaia he Token kua oti mai i ngā whakaurunga wāhanga, ā, ka taunoa ki inherits me syntax.

Ngā Tawhā

input

TokenInput

Whakahokia

Token

Ngā tauira

Tātari i te wetereo mai i tētahi uara mārama

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

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

He kotahi noa te uara var() e tuhi ana i te refersTo; ko te light-dark() ka tautuhi i te 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