Skip to content

pantoken / design/swatches/src / toSvg

Functie: toSvg()

toSvg(swatches, options?): string

Experimenteel

Render kleurstalen als een gegroepeerd SVG-monsterblad.

Parameters

swatches

alleen-lezen Swatch[]

Het palet (bijv. van toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Retourneert

string

Het SVG-document als een tekenreeks.

Voorbeelden

Genereer een specimenblad voor een README

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

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

Toon alleen het kernpalet, met een titel en een breder raster

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