Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
deyihu committed Nov 29, 2022
1 parent 599c0da commit 410ec9a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,29 @@ npm i colorin
# or
yarn add colorin
```

### Warning
in nodejs,you need install @napi-rs/canvas for polyfill canvas

in nodejs, you need dynamic registerCanvas,you can use [@napi-rs/canvas](https://github.com/Brooooooklyn/canvas) or [node-canvas](https://github.com/Automattic/node-canvas)

```sh
npm i @napi-rs/canvas
# or
yarn add @napi-rs/canvas
```

```js
const {
ColorIn,
registerCanvas
} = require('colorin');
const {
createCanvas
} = require('@napi-rs/canvas');
const canvas = createCanvas(1, 1);
registerCanvas(canvas);
```

## API

### `ColorIn` class
Expand Down Expand Up @@ -83,4 +97,5 @@ const [r, g, b, a] = ci.getColor(11);
```js
const imgData = ci.getImageData();
```


0 comments on commit 410ec9a

Please sign in to comment.