Skip to content

pantoken / design/swatches/src / toSvg

Funkcija: toSvg()

toSvg(swatches, options?): string

Eksperimentalno

Upodobi vzorce barv kot združeno SVG-listico vzorcev.

Parametri

swatches

readonly Swatch[]

Paleta (npr. iz toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

Vrne

string

SVG-dokument kot niz.

Primeri

Upodobi listico vzorcev za README

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

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

Prikaži vzorce samo osnovne palete, z naslovom in širšo mrežo

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