Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extract-colors

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-colors - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

lib/extract-colors.cjs

8

lib/color/FinalColor.d.ts
import { FinalColor } from "../types/Color";
import Color from "./Color";
/**
* Normalize color
*
* @param color Initial color
* @param pixels Pixel count of this color
*
* @returns Normalized color
*/
export declare const createFinalColor: (color: Color, pixels: number) => FinalColor;

@@ -19,2 +19,8 @@ import Color from './Color';

* Add color to the group.
*
* @param _hex Hexadecimal value of the color
* @param _red Red chanel amount of the color
* @param _green Green chanel amount of the color
* @param _blue Blue chanel amount of the color
* @returns The color
*/

@@ -24,2 +30,4 @@ addColor(_hex: number, _red: number, _green: number, _blue: number): Color;

* Get list of groups of list of colors.
*
* @returns List of colors
*/

@@ -29,4 +37,6 @@ getList(): Color[];

* Representative color of leaf.
*
* @returns Main color of the leaf
*/
createMainColor(): Color;
}

49

lib/extract-colors.d.ts

@@ -10,2 +10,14 @@ import { BrowserOptions, NodeOptions } from "./types/Options";

* Extract colors from an ImageData object.
*
* @param imageData Data of the image
* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.colorValidator Test function to enable only some colors
* @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.lightnessDistance inimum lightness value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.hueDistance inimum hue value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.crossOrigin support for CORS (only for browser)
*
* @returns List of extracted colors
*/

@@ -16,2 +28,14 @@ export declare const extractColorsFromImageData: (imageData: ImageData | ImageDataAlt, options?: NodeOptions | BrowserOptions) => FinalColor[];

* Browser only
*
* @param image HTML image element
* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.colorValidator Test function to enable only some colors
* @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.lightnessDistance inimum lightness value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.hueDistance inimum hue value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.crossOrigin support for CORS (only for browser)
*
* @returns List of extracted colors
*/

@@ -22,2 +46,14 @@ export declare const extractColorsFromImage: (image: HTMLImageElement, options?: BrowserOptions) => Promise<FinalColor[]>;

* The image will be downloaded.
*
* @param src Image source
* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.colorValidator Test function to enable only some colors
* @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.lightnessDistance inimum lightness value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.hueDistance inimum hue value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.crossOrigin support for CORS (only for browser)
*
* @returns List of extracted colors
*/

@@ -27,5 +63,16 @@ export declare const extractColorsFromSrc: (src: string, options?: BrowserOptions) => Promise<FinalColor[]>;

* Extract colors from a picture.
* Node and Browser support
*
* @param picture Image, image source or image data (node.js context only support image data)
* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.colorValidator Test function to enable only some colors
* @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.lightnessDistance inimum lightness value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.hueDistance inimum hue value between two colors otherwise the colors will be merged (from 0 to 1)
* @param options.crossOrigin support for CORS (only for browser)
*
* @returns List of extracted colors
*/
export declare const extractColors: (picture: string | HTMLImageElement | ImageData | ImageDataAlt, options?: BrowserOptions) => Promise<FinalColor[]>;
export {};

6

package.json
{
"name": "extract-colors",
"version": "4.0.0",
"version": "4.0.1",
"description": "Extract color palettes from images",
"main": "lib/extract-colors.cjs.js",
"module": "lib/extract-colors.es.js",
"main": "lib/extract-colors.cjs",
"module": "lib/extract-colors.mjs",
"types": "lib/extract-colors.d.ts",

@@ -8,0 +8,0 @@ "scripts": {

@@ -6,4 +6,3 @@ # Extract Colors

[![npm gzip bundle size](https://img.shields.io/bundlephobia/minzip/extract-colors?style=flat&color=brightgreen)](https://bundlephobia.com/result?p=extract-colors)
![Browser dependency](https://img.shields.io/badge/browser%20dependency-zero-brightgreen)
![Node dependency](https://img.shields.io/badge/node%20dependency-canvas-yellow)
![zero dependency](https://img.shields.io/badge/dependency-zero-brightgreen)
[![CI](https://github.com/Namide/extract-colors/workflows/CI/badge.svg)](https://github.com/Namide/extract-colors/actions)

@@ -10,0 +9,0 @@ [![code coverage](https://codecov.io/gh/Namide/extract-colors/branch/master/graph/badge.svg?token=80PUQ24PW5)](https://codecov.io/gh/Namide/extract-colors)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc