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 2.0.1 to 2.0.2

23

lib/color/BudGroup.d.ts
import Color from './Color';
/**
* RootGroup colors with algorithms to optimize and merge neighbors colors.
* Manage list of colors to optimize and merge neighbors colors.
*
* @module BudGroup
* @memberof module:core
* @export
* @class BudGroup
*/
/**
* @class
* @classdesc Manage list of colors or groups.
*/
export default class BudGroup {

@@ -24,7 +20,2 @@ count: number;

* Add color to the group.
*
* @param {Number} hex Hexadecimal color from 0x000000 to 0xFFFFFF
* @param {Number} red Integer red chanel from 0 to 255
* @param {Number} green Integer green chanel from 0 to 255
* @param {Number} blue Integer blue chanel from 0 to 255
*/

@@ -38,5 +29,2 @@ addColor(hex: number, red: number, green: number, blue: number): Color;

* Max color weight between the children colors, depends of his saturation and his count.
*
* @param {Number} count Number of pixels in the image.
* @returns {Number}
*/

@@ -46,5 +34,2 @@ getMaxWeight(count: number): number;

* Color with the the max weight between the children colors, depends of his saturation and his count.
*
* @param {Number} count Number of pixels in the image.
* @returns {Number}
*/

@@ -54,6 +39,4 @@ getMaxWeightColor(count: number): Color;

* Max count of colors for a group of colors.
*
* @returns {Number}
*/
getMaxCountColor(): Color;
}

@@ -5,3 +5,2 @@ /**

* @module Color
* @memberof module:core
*/

@@ -24,8 +23,2 @@ /**

* Set red, green and blue colors to create the Color object.
*
* @param {Number} red Red channel integer from 0 to 255
* @param {Number} green Green channel integer from 0 to 255
* @param {Number} blue Blue channel integer from 0 to 255
* @param {Number=} hex Optional hexadecimal color from 0x000000 to 0xFFFFFF
* @returns {Color}
*/

@@ -37,6 +30,2 @@ constructor(red: number, green: number, blue: number, hex?: number);

* - Maximum is 1 (for example between black and white)
*
* @param {Color} colorA Color to compare
* @param {Color} colorB Color to compare
* @returns {Number}
*/

@@ -43,0 +32,0 @@ static distance(colorA: Color, colorB: Color): number;

@@ -7,3 +7,2 @@ import Color from './Color';

* @module RootGroup
* @memberof module:core
*/

@@ -28,4 +27,2 @@ /**

* Neighboring colors has same key.
*
* @param {Number} key Simplication of color
*/

@@ -40,4 +37,2 @@ addRootGroup(key: number): RootGroup;

* Neighboring colors has same key.
*
* @param {Number} key Simplication of color
*/

@@ -47,5 +42,2 @@ addBudGroup(key: number): BudGroup;

* Max color weight between the children colors, depends of his saturation and his count.
*
* @param {Number} count Number of pixels in the image.
* @returns {Number}
*/

@@ -55,5 +47,2 @@ getMaxWeight(count: number): number;

* Color with the the max weight between the children colors, depends of his saturation and his count.
*
* @param {Number} count Number of pixels in the image.
* @returns {Color}
*/

@@ -63,4 +52,2 @@ getMaxWeightColor(count: number): Color;

* Max count of colors for a group of colors.
*
* @returns {Color}
*/

@@ -71,8 +58,4 @@ getMaxCountColor(): Color;

* Importance is calculated with the saturation and count of neighboring colors.
*
* @param {Number} distance Minimum distance between colors (from 0 to 1)
* @param {Number} count Total pixels of image
* @returns {Array<Color>}
*/
getColors(distance: number, count: number): Color[];
}

@@ -5,22 +5,6 @@ import { FinalColor } from "./types/Color";

* Extract colors from an ImageData object.
*
* @param {ImageData} imageData
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/
declare const extractColorsFromImageData: (imageData: ImageData, options?: NodeOptions) => FinalColor[];
/**
* Extract colors from an Image object.
*
* @param {Image} image
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
* Extract colors from an HTMLImageElement.
*/

@@ -31,10 +15,2 @@ declare const extractColorsFromImage: (image: HTMLImageElement, options?: BrowserOptions) => Promise<FinalColor[]>;

* The image will be downloaded.
*
* @param {String} src
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/

@@ -44,10 +20,2 @@ declare const extractColorsFromSrc: (src: string, options?: BrowserOptions) => Promise<FinalColor[]>;

* Extract colors from a picture.
*
* @param {String|HTMLImageElement|ImageData} picture Src, Image or ImageData
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/

@@ -54,0 +22,0 @@ declare const extractColors: (picture: string | HTMLImageElement | ImageData, options?: BrowserOptions) => Promise<FinalColor[]>;

@@ -5,22 +5,6 @@ import { FinalColor } from "./types/Color";

* Extract colors from an ImageData object.
*
* @param {ImageData} imageData
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/
declare const extractColorsFromImageData: (imageData: ImageData, options?: NodeOptions) => FinalColor[];
/**
* Extract colors from an Image object.
*
* @param {Image} image
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
* Extract colors from an HTMLImageElement.
*/

@@ -31,10 +15,2 @@ declare const extractColorsFromImage: (image: HTMLImageElement, options?: BrowserOptions) => Promise<FinalColor[]>;

* The image will be downloaded.
*
* @param {String} src
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/

@@ -44,10 +20,2 @@ declare const extractColorsFromSrc: (src: string, options?: BrowserOptions) => Promise<FinalColor[]>;

* Extract colors from a picture.
*
* @param {String|HTMLImageElement|ImageData} picture Src, Image or ImageData
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/

@@ -54,0 +22,0 @@ declare const extractColors: (picture: string | HTMLImageElement | ImageData, options?: BrowserOptions) => Promise<FinalColor[]>;

11

lib/extract-colors.node.cjs.d.ts

@@ -5,10 +5,2 @@ import { FinalColor } from './types/Color';

* Extract colors from an ImageData object.
*
* @param {Array<Number>} imageData
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/

@@ -20,2 +12,5 @@ declare const extractColorsFromImageData: ({ data, width, height }: {

}, options?: NodeOptions) => FinalColor[];
/**
* Extract colors from an imageData.
*/
declare const extractColors: (imageData: ImageData, options?: NodeOptions) => Promise<FinalColor[]>;

@@ -22,0 +17,0 @@ declare const extractColorsFromImage: () => never;

@@ -5,10 +5,2 @@ import { FinalColor } from './types/Color';

* Extract colors from an ImageData object.
*
* @param {Array<Number>} imageData
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
* @returns {Array<Object>}
*/

@@ -20,2 +12,5 @@ declare const extractColorsFromImageData: ({ data, width, height }: {

}, options?: NodeOptions) => FinalColor[];
/**
* Extract colors from an imageData.
*/
declare const extractColors: (imageData: ImageData, options?: NodeOptions) => Promise<FinalColor[]>;

@@ -22,0 +17,0 @@ declare const extractColorsFromImage: () => never;

import { ExtractorOptions } from '../types/Options';
/**
* Process to extract main colors from list of colors.
*
* @class

@@ -15,15 +17,5 @@ * @classdesc Process to extract neighboring colors.

static colorValidatorDefault: (_red: number, _green: number, _blue: number, alpha?: number) => boolean;
/**
* @param {Object=} options Optional data
* @param {String=} options.pixels Total pixel number of the resized picture for calculation
* @param {String=} options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param {String=} options.splitPower Approximation power in the first color splitting during process (from 2 to 15)
* @param {String=} options.colorValidator Callback with test to enable only some colors
*/
constructor({ pixels, distance, splitPower, colorValidator }?: ExtractorOptions);
/**
* Run extract process and get list of colors.
*
* @param {Array<Number>} data List of colors with an array of flat colors by chanels with 0 to 255 per chanel (red, green, blue, alpha)
* @returns {Array<Color>}
*/

@@ -30,0 +22,0 @@ process({ data, width, height }: ImageData | {

{
"name": "extract-colors",
"version": "2.0.1",
"version": "2.0.2",
"description": "Extract color palettes from images",

@@ -38,3 +38,3 @@ "main": "lib/extract-colors.node.cjs.js",

},
"homepage": "https://extract-colors.namide.com/",
"homepage": "https://extract-colors.namide.com",
"files": [

@@ -41,0 +41,0 @@ "lib"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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