hex-color-converter
v0.2.1
Published
Lightweight module for converting RGB(A) values to hexadecimal colors
Downloads
347
Maintainers
Readme
hex-color-converter
Lightweight module for converting RGB(A) values to hexadecimal colors
Install
npm i hex-color-converter
Usage
const converter = require('hex-color-converter')
const hex = converter('rgba(255, 255, 255, 0.5)')
console.log(hex) // => #FFFFFF80
Documentation
Convert RGB values to hexadecimal color values
To convert RGB values to a hexadecimal color value pass the RGB string to converter
function. RGB strings should be formatted as rgb(255, 255, 255)
converter('rgb(255, 255, 255)')
Convert RGBA values to hexadecimal color values
To convert RGBA values to a hexadecimal color value pass the RGBA string to converter
function. RGBA strings should be formatted as rgba(255, 255, 255, 0.5)
converter('rgb(255, 255, 255, 0.5)')
Contributing
Contributors are welcome, feel free to submit a new pull request to help improve hex-color-converter.