Installing dependencies
The Node.js module system, along with its vast ecosystem enables a high degree of composability. A lot of modules are small and do one thing well, and this allows us to composite our own modules on top of other modules.
In this recipe, we will install a dependency.
Getting ready
For this recipe, all we need is Command Prompt open in the hsl-to-hex
folder from the Scaffolding a module recipe.
How to do it...
Our hsl-to-hex
module can be implemented in two steps:
- Convert the hue degrees, saturation percentage, and luminosity percentage to corresponding red, green, and blue numbers between 0 and 255.
- Convert the RGB values to HEX.
Before we tear into writing an HSL to the RGB algorithm, we should check whether this problem has already been solved.
The easiest way to check is to head to http://npmjs.com and perform a search:

Oh, look! Somebody already solved this.
After some research, we decide that the hsl-to-rgb-for-reals
module is the best fit.
Ensuring that we are in the hsl...