mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 13:54:25 +00:00
docs: Add API table
This commit is contained in:
17
README.md
17
README.md
@@ -8,16 +8,12 @@ A script for grabbing the color palette from an image. Uses Javascript and the c
|
|||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
### Get the dominant color from an image
|
### Get the dominant color from an image
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var colorThief = new ColorThief();
|
var colorThief = new ColorThief();
|
||||||
colorThief.getColor(sourceImage);
|
colorThief.getColor(sourceImage);
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
|
||||||
getColor(sourceImage[, quality])
|
|
||||||
returns [num, num, num]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build a color palette from an image
|
### Build a color palette from an image
|
||||||
|
|
||||||
In this example, we build an 8 color palette.
|
In this example, we build an 8 color palette.
|
||||||
@@ -27,7 +23,10 @@ var colorThief = new ColorThief();
|
|||||||
colorThief.getPalette(sourceImage, 8);
|
colorThief.getPalette(sourceImage, 8);
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
### API
|
||||||
getPalette(sourceImage[, colorCount, quality])
|
|
||||||
returns [ [num, num, num], [num, num, num], ... ]
|
|
||||||
```
|
| Method | Return | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `getColor(image [, quality])` | `[Number, Number, Number]` | WIP |
|
||||||
|
| `getPalette(image [, colorCount, quality]` | `[[Number, Number, Number], ...]` | WIP |
|
||||||
|
|||||||
Reference in New Issue
Block a user