hex-color-converter

0.2.1 • Public • Published

hex-color-converter

GitHub Workflow Status (branch) Code Climate coverage npm js-standard-style

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.

Package Sidebar

Install

npm i hex-color-converter

Weekly Downloads

29

Version

0.2.1

License

MIT

Unpacked Size

10.4 kB

Total Files

8

Last publish

Collaborators

  • dominicegginton