pixar
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

pixar

Installation

npm i --save pixar
 
#or 
 
yarn add pixar

Usage

1. Pick color from image

const path = require('path')
const {parse} = require('pixar')
 
 
setImmediate(async () => {
    const file = path.join(__dirname, 'test.png')
 
    try {
        const parsed = await parse(file, {
            top: 1,
            left: 1,
            width: 100,
            height: 100,
        })
 
        const x = parsed.toHex()
        const rgba = parsed.toRGBA()
        console.log('Hex:', x)
        console.log('RGA:', rgba)
    } catch (error) {
        console.log("ERROR", error)
    }
})

2. Get similar color

 
const {getSimilarColor} = require('pixar')
 
 
setImmediate(async () => {
    const color = '#0a8455'
    const colors = ['#10a068', '#2053a2', '#f2ced8', '#ffb43d', '#91b8e1']
    const similar = getSimilarColor(color, colors)
    console.log(similar)
})
 
 

Readme

Keywords

none

Package Sidebar

Install

npm i pixar

Weekly Downloads

0

Version

1.3.0

License

ISC

Unpacked Size

7.43 kB

Total Files

16

Last publish

Collaborators

  • tutv