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.8 to 4.1.0

lib/assets/worker-BpWVVq8n.js.map

29

lib/extract-colors.d.ts

@@ -1,8 +0,3 @@

import { BrowserOptions, NodeOptions } from "./types/Options";
import { FinalColor } from "./types/Color";
interface ImageDataAlt {
data: Uint8ClampedArray | number[];
width?: number;
height?: number;
}
import { BrowserOptions, ImageDataAlt, NodeOptions } from "./types/Options";
/**

@@ -13,4 +8,4 @@ * Extract colors from an ImageData object.

* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.pixels Total pixel number of the resized picture for calculation
* @param options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param options.colorValidator Test function to enable only some colors

@@ -21,2 +16,3 @@ * @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)

* @param options.crossOrigin support for CORS (only for browser)
* @param options.requestMode support for CORS (only for Web Workers in browser)
*

@@ -32,4 +28,4 @@ * @returns List of extracted colors

* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.pixels Total pixel number of the resized picture for calculation
* @param options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param options.colorValidator Test function to enable only some colors

@@ -40,2 +36,3 @@ * @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)

* @param options.crossOrigin support for CORS (only for browser)
* @param options.requestMode support for CORS (only for Web Workers in browser)
*

@@ -45,2 +42,3 @@ * @returns List of extracted colors

export declare const extractColorsFromImage: (image: HTMLImageElement, options?: BrowserOptions) => Promise<FinalColor[]>;
export declare const extractColorsFromImageBitmap: (image: ImageBitmap, options?: BrowserOptions) => Promise<FinalColor[]>;
/**

@@ -52,4 +50,4 @@ * Extract colors from a path.

* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.pixels Total pixel number of the resized picture for calculation
* @param options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param options.colorValidator Test function to enable only some colors

@@ -60,2 +58,3 @@ * @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)

* @param options.crossOrigin support for CORS (only for browser)
* @param options.requestMode support for CORS (only for Web Workers in browser)
*

@@ -70,4 +69,4 @@ * @returns List of extracted colors

* @param options Process configuration
* @param options.pixels The name of the user.
* @param options.distance The email of the user.
* @param options.pixels Total pixel number of the resized picture for calculation
* @param options.distance From 0 to 1 is the color distance to not have near colors (1 distance is between white and black)
* @param options.colorValidator Test function to enable only some colors

@@ -78,2 +77,3 @@ * @param options.saturationDistance Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)

* @param options.crossOrigin support for CORS (only for browser)
* @param options.requestMode support for CORS (only for Web Workers in browser)
*

@@ -83,2 +83,1 @@ * @returns List of extracted colors

export declare const extractColors: (picture: string | HTMLImageElement | ImageData | ImageDataAlt, options?: BrowserOptions) => Promise<FinalColor[]>;
export {};

@@ -1,2 +0,2 @@

import { BrowserOptions } from "../types/Options";
import { BrowserOptions, OptionsCleaned } from "../types/Options";
/**

@@ -13,3 +13,4 @@ * Default extractor values

export declare const AVERAGE_LIGHTNESS_DEFAULT: number;
declare const _default: ({ pixels, distance, colorValidator, hueDistance, saturationDistance, lightnessDistance, crossOrigin, }?: BrowserOptions) => [number, number, (red: number, green: number, blue: number, alpha: number) => boolean, number, number, number, "" | "anonymous" | "use-credentials" | null];
export declare function testInputs({ pixels, distance, colorValidator, hueDistance, saturationDistance, lightnessDistance, crossOrigin, requestMode, }?: BrowserOptions): void;
declare const _default: ({ pixels, distance, colorValidator, hueDistance, saturationDistance, lightnessDistance, crossOrigin, requestMode, }?: BrowserOptions) => OptionsCleaned;
export default _default;

@@ -0,1 +1,6 @@

export interface ImageDataAlt {
data: Uint8ClampedArray | number[];
width?: number;
height?: number;
}
export interface SorterOptions {

@@ -12,4 +17,15 @@ saturationDistance?: number;

export type BrowserOptions = ExtractorOptions & {
crossOrigin?: "anonymous" | "use-credentials" | "" | null;
crossOrigin?: "anonymous" | "use-credentials" | "";
requestMode?: RequestMode;
} & SorterOptions;
export type NodeOptions = ExtractorOptions & SorterOptions;
export type OptionsCleaned = [
number,
number,
(red: number, green: number, blue: number, alpha: number) => boolean,
number,
number,
number,
"" | "anonymous" | "use-credentials" | null,
RequestMode
];
{
"name": "extract-colors",
"version": "4.0.8",
"version": "4.1.0",
"description": "Extract color palettes from images",

@@ -10,4 +10,4 @@ "main": "lib/extract-colors.cjs",

"prebuild": "rm -rf ./lib",
"build": "vite build --config conf/vite.config.ts && tsc --project conf/tsconfig.type.json",
"postbuild": "mv lib/extractColors.d.ts lib/extract-colors.d.ts; sed -i 's/__DEV__/process.env.NODE_ENV !== \"production\"/g' lib/**.*js ; ",
"build": "vite build --config conf/vite.config.ts && vite build --config conf/vite.config.worker.ts && tsc --project conf/tsconfig.type.json",
"postbuild": "mv lib/extractColors.d.ts lib/extract-colors.d.ts; mv lib/workerWrapper.d.ts lib/worker-wrapper.d.ts; sed -i 's/__DEV__/process.env.NODE_ENV !== \"production\"/g' lib/**.*js ; ",
"lint": "npx eslint --config conf/eslint.config.mjs",

@@ -36,3 +36,4 @@ "lint-fix": "npx eslint --fix --config conf/eslint.config.mjs",

"node",
"hsl"
"hsl",
"web workers"
],

@@ -39,0 +40,0 @@ "author": "damien@doussaud.fr",

@@ -87,3 +87,3 @@ # Extract Colors

> This example use `get-pixels` but you can change the lib.
> Just send and ImageData object to `extractColors(imageData)`.
> Just send the ImageData object to `extractColors(imageData)`.

@@ -124,4 +124,9 @@ ### ExtractorOptions

Type: `String`
Default: `null`
Default: `""`
**requestMode**
_Only for Web Workers in browser: it's used to determine if cross-origin requests lead to valid responses, and which properties of the response are readable_
Type: `String`
Default: `cors`
**saturationDistance**

@@ -128,0 +133,0 @@ _Minimum saturation value between two colors otherwise the colors will be merged (from 0 to 1)_

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