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