From 37ed3529c5b5e38e06f01cb9b5bba1a4887710f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Wed, 10 Jun 2015 12:12:31 +0200 Subject: [PATCH] Changed some on hsl function, and its being used now --- static/js/youtube.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/youtube.js b/static/js/youtube.js index ba1ee8fb..918ec712 100755 --- a/static/js/youtube.js +++ b/static/js/youtube.js @@ -252,7 +252,10 @@ function setBGimage(id){ var img = new Image(); img.onload = function () { 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.src = 'http://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg'; @@ -292,5 +295,5 @@ function rgbToHsl(arr){ h /= 6; } - return [h*360, s*100, l*100]; + return "hsl("+Math.floor(h*360)+", "+Math.floor(s*100)+"%, "+Math.floor(l*50)+"%)"; }