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.
To run all tests:
$ npm run test
To run all tests with a custom reporter (for example, Nyan Cat):
$ npm run test:nyan
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
Feel free to clone this project and add more tests!
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.