/rgb-hex

Primary LanguageTypeScript

rgb-hex

The rgb-hex library contains two simple methods:

  • rgbToHex - Converts numerical decimal color values (RGB) into its hexadecimal equivalent.
  • hexToRgb - Converts a stringified hexadecimal color value into its decimal equivalent.

Running Tests

To run all tests:

$ npm run test

Running Tests

To run all tests with a custom reporter (for example, Nyan Cat):

$ npm run test:nyan

Running Tests with Custom Reporter (Nyan Cat)

Note: To change the reporter, change the --reporters option in the test:nyan script. If using a non-native Jest reporter, then install it as a dev. dependency.

To run all tests in watch mode:

$ npm run test:watch

Running Tests in Watch Mode

Feel free to clone this project and add more tests!

Please Read ⚠️

Please do not use this library in production. The sole purpose of this library is to teach others how to set up unit testing with Jest and TypeScript with minimal hassle.