Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

rgb-hex

2.1.0 • Public • Published

rgb-hex Build Status

Convert RGB(A) color to HEX

Install

$ npm install --save rgb-hex

Usage

const rgbHex = require('rgb-hex');
 
rgbHex(65, 131, 196);
//=> '4183c4'
 
rgbHex('rgb(40, 42, 54)');
//=> '282a36'
 
rgbHex(65, 131, 196, 0.2);
//=> '4183c433'
 
rgbHex(40, 42, 54, '75%');
//=> '282a36c0'
 
rgbHex('rgba(40, 42, 54, 75%)');
//=> '282a36c0'

Related

License

MIT © Sindre Sorhus

install

npm i rgb-hex

Downloadsweekly downloads

394,294

version

2.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability