From 0f590b91ee4ff1856f74272142a9d2e4398947ae Mon Sep 17 00:00:00 2001 From: Lokesh Dhakar Date: Sun, 23 Jun 2013 22:27:41 -0700 Subject: [PATCH] Updated read me --- README.markdown | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/README.markdown b/README.markdown index 38bccc9..bef9fb9 100644 --- a/README.markdown +++ b/README.markdown @@ -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) -``` - -```js -returns [num, num, 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 -```js -createPalette(sourceImage, colorCount) +var colorThief = new ColorThief(); +colorThief.getColor(sourceImage); ``` ```js +getColor(sourceImage[, quality]) +returns {r: num, g: num, b: num} +``` + +###Build a color palette from an image +```js +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.