update RgbHsvConversion.js

This commit is contained in:
algobytewise
2021-04-12 16:20:43 +05:30
committed by GitHub
parent 21c1dda447
commit ecf4ad9eb5

View File

@ -3,7 +3,7 @@
* together in various ways to reproduce a broad array of colors. The name of the model comes from
* the initials of the three additive primary colors, red, green, and blue. Meanwhile, the HSV
* representation models how colors appear under light. In it, colors are represented using three
* components: hue, saturation and (brightness-)value. This class provides methods for converting
* components: hue, saturation and (brightness-)value. This file provides functions for converting
* colors from one representation to the other. (description adapted from
* https://en.wikipedia.org/wiki/RGB_color_model and https://en.wikipedia.org/wiki/HSL_and_HSV).
*/
@ -142,6 +142,10 @@ function approximatelyEqualHsv (hsv1, hsv2) {
function getRgbBySection (
hueSection, chroma, matchValue, secondLargestComponent) {
function convertToInt (input) {
return Math.round(255 * input)
}
let red
let green
let blue
@ -174,7 +178,3 @@ function getRgbBySection (
return [red, green, blue]
}
function convertToInt (input) {
return Math.round(255 * input)
}