npm.io
4.0.5 • Published 2 years ago

@types/get-image-colors

Licence
MIT
Version
4.0.5
Deps
2
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/get-image-colors

Summary

This package contains type definitions for get-image-colors (https://github.com/colorjs/get-image-colors#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/get-image-colors.

index.d.ts

/// <reference types="node" />

import { Color } from "chroma-js";

/**
 * Extract colors from images. Supports GIF, JPG, PNG, and even SVG!
 */
declare function colorPalette(
    input: Buffer | string,
    typeOrOptions: string | colorPalette.Options,
    callback: colorPalette.Callback,
): void;
declare function colorPalette(input: Buffer | string, typeOrOptions?: string | colorPalette.Options): Promise<Color[]>;
declare function colorPalette(input: Buffer | string, callback: colorPalette.Callback): void;

declare namespace colorPalette {
    interface Options {
        /**
         * @default undefined
         */
        type?: string | undefined;
        /**
         * @default 5
         */
        count?: number | undefined;
    }

    /**
     * If you don't like promises, you can use node-style callbacks too
     */
    type Callback = (error: Error | null, colors: Color[]) => void;
}

export = colorPalette;

Additional Details

Credits

These definitions were written by Piotr Błażejewicz.