npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

rgb-hex-conv

1.0.3 • Public • Published

rgb-hex-conv

Convert RGB values of a color to a hexadecimal notation 6-digit or 3-digit string

Usage

const rgbHexConv = require('rgb-hex-conv');
 
// 6 digits hexadecimal notation
rgbHexConv(2,3,4);
// returns '020304'
rgbHexConv(255,0,255);
// returns 'FF00FF'
rgbHexConv(200,123,49);
// returns 'C87B31'
rgbHexConv(123,97,1);
// returns '7B6101'
 
// 3 digits hexadecimal notation
rgbHexConv(2,3,4, true);
// returns '000'
rgbHexConv(255,0,255, true);
// returns 'F0F'
rgbHexConv(200,123,49, true);
// returns 'C73'
rgbHexConv(123,97,1, true);
// returns '760'

License

MIT © Damian Polak

install

npm i rgb-hex-conv

Downloadsweekly downloads

0

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability