Skip to content

pantoken / design/swatches/src / toSvg

Funktio: toSvg()

toSvg(swatches, options?): string

Kokeellinen

Renderoi värinäytteet ryhmiteltynä SVG-esimerkkilehdelle.

Parametrit

swatches

vain-luku Swatch[]

Paletti (esim. toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Palauttaa

string

SVG-dokumentti merkkijonona.

Esimerkit

Renderoi näytesivu README:lle

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

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

Näytä vain ydinpaletti näytteenä, otsikolla ja leveämmällä ruudukolla

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