Skip to content

Instantly share code, notes, and snippets.


Bagaev Dmitry bvdmitri

View GitHub Profile
mjackson / color-conversion-algorithms.js
Last active May 18, 2021
RGB, HSV, and HSL color conversion algorithms in JavaScript
View color-conversion-algorithms.js
* Converts an RGB color value to HSL. Conversion formula
* adapted from
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation