mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 13:54:25 +00:00
more rm updates
This commit is contained in:
@@ -3,7 +3,7 @@ by Lokesh Dhakar - [Blog](http://lokeshdhakar.com) - [Twitter](http://twitter.co
|
|||||||
|
|
||||||
A script for grabbing the dominant color or a representative color palette from an image. Uses javascript and canvas.
|
A script for grabbing the dominant color or a representative color palette from an image. Uses javascript and canvas.
|
||||||
|
|
||||||
### [Demo](http://lokeshdhakar.com/projects/color-thief)
|
[**See a Demo**](http://lokeshdhakar.com/projects/color-thief)
|
||||||
|
|
||||||
###Requirements
|
###Requirements
|
||||||
* jQuery
|
* jQuery
|
||||||
@@ -11,14 +11,16 @@ A script for grabbing the dominant color or a representative color palette from
|
|||||||
|
|
||||||
###Usage
|
###Usage
|
||||||
|
|
||||||
|
####Dominant Color
|
||||||
```js
|
```js
|
||||||
getDominantColor(sourceImage)
|
getDominantColor(sourceImage)
|
||||||
returns {r: num, g: num, b: num}
|
|
||||||
```
|
```
|
||||||
|
returns {r: num, g: num, b: num}
|
||||||
|
|
||||||
Use 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
|
||||||
```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}, ...]
|
||||||
|
|||||||
Reference in New Issue
Block a user