Using HSL function even tho it is weirdlooking because nicolas wants me to use it, even though it is weird

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-09 22:58:28 +02:00
parent 78d23a0642
commit 9986d5088c
2 changed files with 3 additions and 3 deletions

View File

@@ -44,5 +44,4 @@ socket.on("id", function(id)
else if(arr[0] == "skip")
skip();
});
}
});

View File

@@ -252,7 +252,7 @@ function setBGimage(id){
var img = new Image();
img.onload = function () {
var colorThief = new ColorThief();
$("body").css("background-color", colorThief.getColor(img));
$("body").css("background-color", rgbToHsl(colorThief.getColor(img)));
};
img.crossOrigin = 'Anonymous';
img.src = 'http://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
@@ -273,7 +273,8 @@ function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
function rgbToHsl(r, g, b){
function rgbToHsl(arr){
r = arr[0], g = arr[1], b = arr[2];
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;