Skip to content

pantoken / design/swatches/src / toGpl

Function: toGpl()

toGpl(swatches, options?): string

Experimental

Encode swatches as a GIMP .gpl palette string.

Parameters

swatches

readonly Swatch[]

The palette.

options?

ToGplOptions = {}

ToGplOptions.

Returns

string

Examples

Write a GIMP .gpl palette

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

writeFileSync("instructure.gpl", toGpl(swatches));

With a custom palette name

ts
import { swatches, toGpl } from "@pantoken/swatches";

const gpl = toGpl(swatches, { name: "Instructure Rebrand" });