extract-colors
Advanced tools
Comparing version 4.0.0 to 4.0.1
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; | ||
} |
@@ -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 {}; |
{ | ||
"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) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
137847
699
204