docs: Add API table

This commit is contained in:
Lokesh Dhakar
2019-05-02 08:23:32 -07:00
parent eb38ecf0dc
commit fed4154d29

View File

@@ -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 |