Skip to content

pantoken / design/swatches/src / toSvg

Ֆունկցիա: toSvg()

toSvg(swatches, options?): string

Փորձարկումային

Ցուցադրել նմուշները՝ խմբավորված SVG նմուշաթերթի տեսքով։

Պարամետրեր

swatches

միայն կարդացվող Swatch[]

Գույնապանակը (օր.՝ toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Վերադարձվող արժեք

string

SVG փաստաթուղթը որպես տող։

Օրինակներ

README-ի համար նմուշաթերթիկ ստեղծել

ts
import { writeFileSync } from "node:fs";
import { swatches, toSvg } from "@pantoken/swatches";

writeFileSync("palette.svg", toSvg(swatches));

Նմուշ՝ միայն հիմնական գույնապանակը՝ վերնագրով և լայնացված ցանցով

ts
import { swatches, toSvg } from "@pantoken/swatches";

const core = swatches.filter((s) => !s.name.startsWith("primitive-"));
const svg = toSvg(core, { title: "Instructure core colors", columns: 8 });