mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
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:
@@ -44,5 +44,4 @@ socket.on("id", function(id)
|
||||
else if(arr[0] == "skip")
|
||||
skip();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user