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