hex2rgbcolor
v2.0.1
Published
Javascript plugin that allows conversions between RGB and Hexadecimal
Downloads
5
Maintainers
Readme
Hex2rgbcolor
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']
Test
jest