mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 22:04:25 +00:00
more rm updates
This commit is contained in:
@@ -1,17 +1,9 @@
|
|||||||
# Color Thief
|
## Color Thief
|
||||||
by Lokesh Dhakar - [Blog](http://lokeshdhakar.com) - [Twitter](http://twitter.com/lokeshdhakar)
|
A script for grabbing the dominant color or a representative color palette from an image. Uses javascript and canvas. [**See a Demo**](http://lokeshdhakar.com/projects/color-thief)
|
||||||
|
|
||||||
A script for grabbing the dominant color or a representative color palette from an image. Uses javascript and canvas.
|
|
||||||
|
|
||||||
[**See a Demo**](http://lokeshdhakar.com/projects/color-thief)
|
|
||||||
|
|
||||||
###Requirements
|
|
||||||
* jQuery
|
|
||||||
* quantize.js
|
|
||||||
|
|
||||||
###Usage
|
###Usage
|
||||||
|
|
||||||
####Dominant Color
|
####Get Dominant Color
|
||||||
```js
|
```js
|
||||||
getDominantColor(sourceImage)
|
getDominantColor(sourceImage)
|
||||||
```
|
```
|
||||||
@@ -20,15 +12,17 @@ returns {r: num, g: num, b: num}
|
|||||||
Uses the median cut algorithm provided by quantize.js to cluster similar
|
Uses the median cut algorithm provided by quantize.js to cluster similar
|
||||||
colors and return the base color from the largest cluster.
|
colors and return the base color from the largest cluster.
|
||||||
|
|
||||||
####Palette
|
####Create Palette
|
||||||
```js
|
```js
|
||||||
createPalette(sourceImage, colorCount)
|
createPalette(sourceImage, colorCount)
|
||||||
returns array[ {r: num, g: num, b: num}, {r: num, g: num, b: num}, ...]
|
|
||||||
```
|
```
|
||||||
|
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
|
Use the median cut algorithm provided by quantize.js to cluster similar
|
||||||
colors.
|
colors.
|
||||||
|
|
||||||
BUGGY: Function does not always return the requested amount of colors. It can be +/- 2.
|
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](http://creativecommons.org/licenses/by/2.5/)
|
Licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/)
|
||||||
Reference in New Issue
Block a user