mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Changed some on hsl function, and its being used now
This commit is contained in:
@@ -252,7 +252,10 @@ function setBGimage(id){
|
|||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.onload = function () {
|
img.onload = function () {
|
||||||
var colorThief = new ColorThief();
|
var colorThief = new ColorThief();
|
||||||
$("body").css("background-color", colorThief.getColor(img));
|
console.log(rgbToHsl(colorThief.getColor(img)));
|
||||||
|
document.getElementsByTagName("body")[0].style.backgroundColor = rgbToHsl(colorThief.getColor(img))
|
||||||
|
//$("body").css("background-color", rgbToHsl(colorThief.getColor(img)));
|
||||||
|
//$("body").css("background-color", colorThief.getColor(img));
|
||||||
};
|
};
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
img.src = 'http://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
img.src = 'http://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
||||||
@@ -292,5 +295,5 @@ function rgbToHsl(arr){
|
|||||||
h /= 6;
|
h /= 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [h*360, s*100, l*100];
|
return "hsl("+Math.floor(h*360)+", "+Math.floor(s*100)+"%, "+Math.floor(l*50)+"%)";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user