1.0.2 • Published 6 years ago

hex-rgb-color-code-converter v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

hex-rgb-color-code-converter

This is a simple module providing a function that converts web color code from rgb format (as rgb(0, 255, 0) to hex format (as #00ffe7) and vice versa.

Why

The module got as a completion of a challenge having at a course of Udemy "The Complete Web Developer in 2018: Zero to Mastery". It is obviously a simple function that every developer can write on their own. But why to waste time?

Installation and Usage

The recommended installation method is a local NPM install for your project:

$ npm install hex-rgb-color-code-converter

then use it in project files:

import rgbHexColorCodeConverter from 'hex-rgb-color-code-converter';

let hexColorString = rgbHexColorCodeConverter('rgb(0, 191, 255)');
// expected result: #00bfff

let rgbColorString = rgbHexColorCodeConverter('#00bfff');
// expected result: rgb(0, 191, 255)