Javascript plugin that allows conversions between RGB and Hexadecimal.
Install
npm install hex2rgbcolor
Usage
import { hexToRgb, arrayHexToRgb, arrayRgbToHex } from 'hex2rgbcolor';
const a = ['#f00', '#abc001', '#ba0'];
hexToRgb('#F00') // { r: 255, g: 0, b: 0 }
arrayHexToRgb(a); // [{"b": 0, "g": 0, "r": 255}, {"b": 1, "g": 192, "r": 171}, {"b": 0, "g": 170, "r": 187}]
const b = [
{"b": 0, "g": 0, "r": 255},
{"b": 1, "g": 192, "r": 171},
{"b": 0, "g": 170, "r": 187}
];
arrayRgbToHex(b); // ['#ff0000', '#abc001', '#bbaa00']
yiq_is_light('#000000'); // false
yiq_is_light('#ffffff'); // true
Test
jest