Skip to content

pantoken / design/swatches/src / toSvg

Fall: toSvg()

toSvg(swatches, options?): string

Tilrauna

Sýna litadæmi sem hópað SVG-sýnishornablað.

Færibreytur

swatches

aðeins-lesið Swatch[]

Litatöflan (t.d. úr toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Skilar

string

SVG-skjalið sem strengur.

Dæmi

Búa til sýnishornablað fyrir README

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

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

Sýna aðeins grunnlitatöfluna, með titli og breiðari rist

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