is-rgb

1.0.0 • Public • Published

is-rgb

Build Status

Check if an array contains a valid rgb color code

Table of contents

Installation

$ npm install --save is-rgb

Or if you prefer yarn:

$ yarn add is-rgb

Usage

const is_rgb = require('is-rgb');
 
// If no callback function is given, is_rgb returns a promise
is_rgb([0, 100, 200])
  .then(result => console.log(result)) // true
  .catch(err => console.error(err));
 
// Here with a given callback function
is_rgb([1, 101, 201], (err, result) => {
  if (err) console.error(err);
 
  console.log(result); // true
});
 
// You can also give three single parameters instead of an array
is_rgb(2, 102, 202, (err, result) => {
  if (err) console.error(err);
 
  console.log(result); // true
});
 

Development

$ npm test

Changelog

  • 1.0.0
    • Initial Release

Dependents (1)

Package Sidebar

Install

npm i is-rgb

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • sydev