Skip to content

pantoken / design/swatches/src / toSvg

함수: toSvg()

toSvg(swatches, options?): string

실험적

스와치를 그룹화된 SVG 시편 시트로 렌더링합니다.

매개변수

swatches

읽기 전용 Swatch[]

팔레트(예: toSwatches).

options?

ToSvgOptions = {}

ToSvgOptions.

반환값

string

SVG 문서를 문자열로 제공합니다.

예제들

README용 시편 시트를 렌더링합니다

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

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

제목과 넓은 그리드를 포함한 핵심 팔레트만 시편화합니다

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