rgb-hex
Convert RGB(A) color to HEX
Last updated 9 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm
$ cnpm install rgb-hex 
SYNC missed versions from official npm registry.

rgb-hex Build Status

Convert RGB(A) color to HEX

Install

$ npm install 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%');
//=> '282a36bf'

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

Related

License

MIT © Sindre Sorhus

Current Tags

  • 2.1.0                                ...           latest (9 years ago)

2 Versions

  • 1.0.0                                ...           11 years ago
  • 2.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org