Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Vincz/color-thief

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color Thief

A script for grabbing the dominant color or a representative color palette from an image. Uses javascript and canvas.

###See a Demo

###Usage

####Get Dominant Color

getDominantColor(sourceImage)

returns {r: num, g: num, b: num}

Uses the median cut algorithm provided by quantize.js to cluster similar colors and return the base color from the largest cluster.

####Create Palette

createPalette(sourceImage, colorCount)

returns array[ {r: num, g: num, b: num}, {r: num, g: num, b: num}, ...]

Use the median cut algorithm provided by quantize.js to cluster similar colors.

BUGGY: Function does not always return the requested amount of colors. It can be +/- 2.

###License Licensed under the Creative Commons Attribution 2.5 License

About

Grab the color palette from an image using just Javascript. Works in the browser and in Node.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 67.4%
  • HTML 26.1%
  • CSS 6.5%