rgb-hex
TypeScript icon, indicating that this package has built-in type declarations

4.1.0 • Public • Published

rgb-hex

Convert RGB(A) color to HEX

Install

$ npm install rgb-hex

Usage

import rgbHex from '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%');
//=> '282a36bf'

rgbHex('rgba(40, 42, 54, 75%)');
//=> '282a36bf'

Related

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.1.0
    78,745
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.1.0
    78,745
  • 4.0.1
    4,302
  • 4.0.0
    3,235
  • 3.0.0
    65,060
  • 2.1.0
    130,650
  • 2.0.0
    1
  • 1.0.0
    13,224

Package Sidebar

Install

npm i rgb-hex

Weekly Downloads

295,217

Version

4.1.0

License

MIT

Unpacked Size

4.82 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus