catppuccin-palette/types/procreate-swatches.d.ts
uncenter 88e2795c5d
feat: add support for apple color list / .clr files (#87)
* feat: add support for apple color list / .clr files

* style: format with swift-format

* refactor: minor changes

* refactor: simplify `hexToRGBA`

* fix: use `red` not `calibratedRed` parameter for NSColor

* refactor: clean up arg handling

* ci(release-please): use macos runner, setup swift

* fix: import Buffer type

* fix: require `COMPILE_APPLE_COLOR_LIST=1`

* ci(test): switch to macos & build everything

* ci: upload palettes as artifact

* Update .github/workflows/test.yml

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>

---------

Co-authored-by: sgoudham <sgoudham@gmail.com>
Co-authored-by: Hammy <58985301+sgoudham@users.noreply.github.com>
2024-09-08 16:40:44 +01:00

37 lines
851 B
TypeScript

import type { Buffer } from "node:buffer";
type ColorSpace = "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch";
type Colors = [number[], ColorSpace][];
export function readSwatchesFile(
data: string | Uint8Array | ArrayBuffer | Blob,
colorSpace?: ColorSpace,
): Promise<{
name: string;
colors: Colors;
}>;
type SwatchReturnType = {
text: string;
base64: string;
binarystring: string;
array: number[];
uint8array: Uint8Array;
arraybuffer: ArrayBuffer;
blob: Blob;
nodebuffer: Buffer;
};
export function createSwatchesFile<
F extends keyof SwatchReturnType | undefined = undefined,
>(
name: string,
colors: Colors,
format?: F,
): Promise<F extends keyof SwatchReturnType ? SwatchReturnType[F] : Uint8Array>;
interface ProcreateSwatchesError extends Error {
name: "ProcreateSwatchesError";
message: string;
}