Skip to content

pantoken / design/swatches/src / toSvg

Fonksiyon: toSvg()

toSvg(swatches, options?): string

Deneysel

Renk örneklerini gruplanmış bir SVG örnek sayfası olarak oluştur.

Parametreler

swatches

readonly Swatch[]

Palet (örn. toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Döndürür

string

SVG belgesi bir dize olarak.

Örnekler

README için bir örnek sayfası oluştur

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

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

Başlık ve daha geniş ızgara ile yalnızca çekirdek paleti örnekle

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