Getting main tone of a image.
Visit imageMainTone demo for preview, which using main tone of a picture as background and theme-color
meta.
1.install dependencies using npm or yarn
npm install imageMainTone
yarn add imageMainTone
2.for example:
const imageMainTone = require('imageMainTone');
imageMainTone('https://picsum.photos/1024/?random').then(rgba => {
console.log(rgba)
})
Getting main tone of a image.
parameters:
- [image] {Image | String} image instance or url of image
- [filterWhite] {Boolean} whether to filter the color similar to white, default is true
Success will return color object, containing blow properties:
- r {Number} R value of the main tone
- g {Number} G value of the main tone
- b {Number} B value of the main tone
- a {Number} A value of the main tone
yarn
yarn run serve
yarn run build
yarn run test
yarn run lint