Skip to content

pantoken-root / design/swatches/src / toSvg

دالة: toSvg() ​

toSvg(swatches, options?): string

Experimental

عرض عينات الألوان كصفحة عيّنة SVG مجمعة.

Parameters ​

swatches ​

للقراءة فقط Swatch[]

لوحة الألوان (على سبيل المثال من toSwatches).

options? ​

ToSvgOptions = {}

ToSvgOptions.

Returns ​

string

مستند SVG كسلسلة نصية.

Examples ​

عرض ورقة عيّنة لملف 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 });