mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 13:54:25 +00:00
feat: Node support via color-thief-node.js using get-pixel lib
This commit is contained in:
12
node.js
Normal file
12
node.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { resolve } = require('path');
|
||||
const ColorThief = require(resolve(process.cwd(), "src/color-thief-node.js"));
|
||||
|
||||
const img = resolve(process.cwd(), 'cypress/test-pages/img/rainbow-vertical.png');
|
||||
|
||||
ColorThief.getColor(img)
|
||||
.then(color => { console.log(color) })
|
||||
.catch(err => { console.log(err) })
|
||||
|
||||
ColorThief.getPalette(img)
|
||||
.then(palette => { console.log(palette) })
|
||||
.catch(err => { console.log(err) })
|
||||
Reference in New Issue
Block a user