Skip to content

pantoken / design/swatches/src / toSvg

Funkcja: toSvg()

toSvg(swatches, options?): string

Eksperymentalne

Renderuj próbki jako zgrupowany arkusz wzorcowy SVG.

Parametry

swatches

tylko do odczytu Swatch[]

Paleta (np. z toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Zwraca

string

Dokument SVG jako łańcuch znaków.

Przykłady

Wygeneruj arkusz wzorcowy dla README

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

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

Prezentuj wyłącznie podstawową paletę, z tytułem i szerszą siatką

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