Skip to content

pantoken-root / design/swatches/src / toSvg

Swyddogaeth: toSvg() ​

toSvg(swatches, options?): string

Arbrofol

Rendro samplau lliw fel daflen sampl SVG wedi'i grwpio.

Paramedrau ​

swatches ​

darllen yn unig Swatch[]

Y palet (er enghraifft o toSwatches).

options? ​

ToSvgOptions = {}

ToSvgOptions.

Yn dychwelyd ​

string

Y ddogfen SVG fel llinyn.

Enghreifftiau ​

Rendro daflen sampl ar gyfer README

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

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

Samplu dim ond y palet craidd, gyda theitl a grid ehangach

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