Iris is a JavaScript library designed to facilitate the management of RGB and HEX colors.
To install Iris simply go to your preferred code editor and in its terminal run the following command:
$ npm i iris-colors
To start using the library in your project, import it in the main file:
import iris from 'iris-colors';
The Iris library offers 6 different functions: getType()
, toRgb()
, toHex()
, randomColor()
, findComplementary()
, addOpacity()
.
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'