Skip to content

pantoken / design/swatches/src / toSvg

Funksjon: toSvg()

toSvg(swatches, options?): string

Eksperimentell

Gjengi fargeprøver som et gruppert SVG-prøveark.

Parametere

swatches

readonly Swatch[]

Paletten (f.eks. fra toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Returnerer

string

SVG-dokumentet som en streng.

Eksempler

Generer et prøveark for en README

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

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

Vis bare kjernepaletten som prøve, med tittel og bredere 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 });