Skip to content

Commit

Permalink
Updated read me
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh committed Jun 24, 2013
1 parent b088790 commit 0f590b9
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
#Color Thief

A script for grabbing the dominant color or color palette from an image. Uses javascript and canvas.
A script for grabbing the color palette from an image. Uses Javascript and the canvas tag to make it happen.

[See a Demo](http://lokeshdhakar.com/projects/color-thief) | [Read more on my blog](http://lokeshdhakar.com/color-thief)

##Usage
##How to use

###Get Dominant Color
###Get the dominant color from an image
```js
getDominantColor(sourceImage)
var colorThief = new ColorThief();
colorThief.getColor(sourceImage);
```

```js
returns [num, num, num]
getColor(sourceImage[, quality])
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
###Build a color palette from an image
```js
createPalette(sourceImage, colorCount)
var colorThief = new ColorThief();
colorThief.getPalette(sourceImage);
```

```js
getPalette(sourceImage, colorCount[, quality])
returns [ [num, num, num], [num, num, num], ... ]
```

Use the median cut algorithm provided by quantize.js to cluster similar
colors.
##Credits and license

##License
by Lokesh Dhakar | [lokeshdhakar.com](http://www.lokeshdhakar.com) | [twitter.com/lokeshdhakar](http://twitter.com/lokeshdhakar)
###Author
by Lokesh Dhakar
[lokeshdhakar.com](http://www.lokeshdhakar.com)
[twitter.com/lokeshdhakar](http://twitter.com/lokeshdhakar)

Thanks to [jfsiii](https://github.com/jfsiii) for a large number of code improvements and others for submitting issues and fixes.
###Thanks
* Nick Rabinowitz - For creating quantize.js.
* John Schulz - For clean up and optimization. @JFSIII
* Nathan Spady - For adding drag and drop support to the demo page.

###License
Licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/)

* Free for use in both personal and commercial projects.

0 comments on commit 0f590b9

Please sign in to comment.