JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38
  • Score
    100M100P100Q59960F
  • License MIT

Color extraction library. In TypeScript/JavaScript. For browser/server.

Package Exports

  • colorgram

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (colorgram) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Colorgram Build Status

Color extraction library. In TypeScript/JavaScript. For browser/server.

Demo

test/browser_test.html

Features

  • small size, 1kB (minified + gzipped)
  • pretty fast, 512×512 pixels in 50ms, 340×340 pixels in ~15ms (6× slower on mobile)
  • scans every pixel
  • identical output for rotated images
  • sampled by top 2 bits of 3 groups: H, L, and luminance
  • calculates average per group
  • fixed memory footprint, samples using 2 (bits) ^ 3 (groups) * 4 (RGB + count) * 4 (Uint32) = 65536 bytes
  • usually generates small (~16 colors) palette of main colors
  • supports RGB and RGBA input pixel array (compatible with ImageData.data)
  • using TypedArray
  • no native dependencies

Similar stuff

Install

npm install colorgram

Usage

See test folder.

TypeScript documentation

http://darosh.github.io/colorgram-js/doc/

License

MIT