A JS Color library for RGB/HEX/HSL/XYZ/LAB/LCH conversion


For a data visualization project I was working on recently, I realized that I was going to need to use some random color generation so I decided to package up and publish a color library I had written last year. The library’s main focus, however, is on color conversion, particularly to LCH. As you can see below, The HSL model for picking colors can have a drastic impact on your UI, because changing the hue can impact visual saturation and lightness. Converting to LCH first can alleviate those problems.

The library also offers some useful general functionality for web developers, such as random color generation and contrast ratio calculation.