Skip to content

pantoken / packages/core/src / toStyleDictionary

Swyddogaeth: toStyleDictionary()

toStyleDictionary(tokens, mode?): Record<string, SdLeaf>

Bêta

Siapiwch yr IR a ddatryswyd fel geiriadur tokenau Style Dictionary syml wedi'i allweddio gan enw'r token (gyda'r -- ar y blaen wedi'i dynnu). Cyflenwch hyn i tools/sd-config ar gyfer y emitwyr brodorol.

Paramedrau

tokens

readonly Token[]

Yr IR.

mode?

Mode = "light"

Pa fodd lliw i'w ddatrys (diofyn "light").

Yn dychwelyd

Record<string, SdLeaf>

Gwrthrych geiriadur Style Dictionary.

Enghraifft

Siapiwch yr IR ar gyfer y llinach frodorol

ts
import { buildTokens } from "@pantoken/core/build";
import { toStyleDictionary } from "@pantoken/core";

const dictionary = toStyleDictionary(buildTokens(), "light");
// → { "instui-color-background-base": { value: "#…", type: "color" }, … }
// keys drop the leading "--"; feed this to tools/sd-config.