/iris

Iris is a JavaScript/TypeScript library that helps manage RGB and HEX colors

Primary LanguageTypeScript

Iris logo


Iris is a JavaScript library designed to facilitate the management of RGB and HEX colors.


Installation

To install Iris simply go to your preferred code editor and in its terminal run the following command:

 
$ npm i iris-colors
 

Usage

To start using the library in your project, import it in the main file:

 
import iris from 'iris-colors';
 

Functions

The Iris library offers 6 different functions: getType(), toRgb(), toHex(), randomColor(), findComplementary(), addOpacity().

The getType() function

The getType() function is useful to get the type of a color from input. It will detect if the input color is an rgb or an hex color. If it doesn't understand the type of the input color it will return invalid.

 
import iris from 'iris-colors';

let type = iris.getType('#ff0000');

console.log(type);
 
 
>> 'hex'