Skip to content

pantoken / design/swatches/src / toSvg

Funksjon: toSvg()

toSvg(swatches, options?): string

Eksperimentell

Gjengi fargeprøvar som eit gruppert SVG-prøveark.

Parametrar

swatches

skrivebeskytta Swatch[]

Paletten (t.d. frå toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Returnerer

string

SVG-dokumentet som ein tekststreng.

Døme

Gjengi eit prøveark for ein README

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

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

Prøv berre kjernepaletten, med ein tittel og eit breiare rutenett

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