Skip to content

pantoken / design/swatches/src / toSvg

फंक्शन: toSvg()

toSvg(swatches, options?): string

प्रयोगात्मक

स्वैच को एक समूहित SVG नमूना शीट के रूप में रेंडर करें।

पैरामीटर

swatches

readonly 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 });