OnTake / Youtube Custom Theme

// ==UserScript==
// @name         Youtube Custom Theme
// @namespace    http://www.youtube.com/
// @version      2.79
// @description  Custom Youtube Theme
// @author       Ontake
// @match        https://www.youtube.com/*
// @grant        none
// @copyright 2020, OnTake (https://openuserjs.org/users/OnTake)
// @license MIT
// ==/UserScript==


//var backgroundimageurl = "url(https://ontake.reeee.ee/z8RMzE.png)";
var backgroundimageurl = "url(https://ontake.reeee.ee/wiBgvx.png)";
var color = "linear-gradient(45deg, rgba(44,49,64,0.5) 0%, rgba(37,35,52,0.5) 100%)," + backgroundimageurl;
var colorlight = "linear-gradient(45deg, rgba(44,49,64,0.2) 0%, rgba(37,35,52,0.2) 100%)," + backgroundimageurl;
var colornobg = "linear-gradient(45deg, rgba(44,49,64,1) 0%, rgba(37,35,52,1) 100%)";
var colorsaturated = "linear-gradient(45deg, rgba(55, 89, 191, 1) 0%, rgba(63, 48, 179,1) 100%)";
//var color = "url(\"https://i.imgur.com/HGLZkO7.jpg\")";
//var scale = "2000px";

let root = document.documentElement;

function changetheme() {
    try {
        //document.getElementById("primary").style.backgroundImage = color;
        //document.getElementById("primary").style.backgroundRepeat="repeat";

        document.getElementById("guide-inner-content").style.backgroundImage = color;
        document.getElementById("guide-inner-content").style.backgroundRepeat = "repeat";
        document.getElementById("guide-inner-content").parentElement.style.background = colornobg;
        document.getElementById("guide-inner-content").style.backgroundPosition = "1px 43px";

        document.getElementById("content").style.backgroundImage = color;
        document.getElementById("content").style.backgroundRepeat = "repeat";
        document.getElementById("content").parentElement.style.background = colornobg;
        document.getElementById("content").style.backgroundPosition = "0px 45px";

        document.getElementById("container").style.backgroundImage = color;
        document.getElementById("container").style.backgroundRepeat = "repeat";
        document.getElementById("container").parentElement.style.background = colornobg;
        //Channel Page
        try {
            document.getElementById("channel-container").style.backgroundImage = colorlight;
            document.getElementById("channel-container").style.backgroundRepeat = "repeat";

            document.getElementById("page-manager").style.background = colornobg;

            document.getElementsByClassName("ytd-page-manager")[0].style.backgroundRepeat = "repeat";
            document.getElementsByClassName("ytd-page-manager")[0].style.background = colorlight;
        } catch (error) {
            console.log(error);
            console.log("Not on channel page");
        }
        //Viewer
        document.getElementsByTagName("ytd-mini-guide-renderer")[0].style.backgroundImage = color;
        document.getElementsByTagName("ytd-mini-guide-renderer")[0].style.backgroundRepeat = "repeat";
        document.getElementsByTagName("ytd-mini-guide-renderer")[0].style.background = colornobg;
        try {
            document.getElementsByClassName("ytp-scrubber-button")[0].style.background = colorsaturated;
            var swatches = document.getElementsByClassName("ytp-swatch-background-color");
            for(var swatchindex in swatches){
            swatches[swatchindex].style.background = colorsaturated;
            }
        } catch (error) {
            console.log(error);
            console.log("Not on view page");
        }
        //Subscribe Button
        try {
            document.getElementsByClassName("ytd-subscribe-button-renderer")[0].style.background = colorsaturated;
        } catch (error) {
            console.log(error);
            console.log("No subscribe button in page");
        }
        //document.getElementsByTagName("ytd-watch-flexy")[0].style.backgroundSize = scale;
        //document.getElementById("primary").style.backgroundSize = scale;
        //document.getElementById("guide-inner-content").style.backgroundSize = scale;
        //document.getElementById("content").style.backgroundSize = scale;
        //document.getElementById("container").style.backgroundSize = scale;
        root.style.setProperty("--ytd-video-primary-info-renderer-title-color", "white");
        root.style.setProperty("--yt-spec-text-primary", "white");
        root.style.setProperty("--ytd-video-primary-info-renderer-title-text-shadow", "none");
        var csselement = document.createElement("style");
        csselement.innerHTML = "body::-webkit-scrollbar{width: 0.5vw;}body::-webkit-scrollbar-thumb {background-color: white;}.yt-icon-container{transition:filter 2s ease;filter:hue-rotate(0deg);}.yt-icon-container:hover{filter:hue-rotate(360deg);}.video-stream{border-radius:1vw;}.ytd-app{border-radius:1vw;}paper-button.ytd-subscribe-button-renderer{border-radius:3vw;}paper-button.ytd-subscribe-button-renderer {border-radius:1vw;}#container.ytd-masthead{border-radius:100vw;}ytd-masthead#masthead{border-radius: 100vw;border: #666666 1px solid;}#tabs-inner-container.ytd-c4-tabbed-header-renderer{background-color:#FFFFFF11;}#tabs-container.ytd-c4-tabbed-header-renderer{background-color:transparent;}#channel-header.ytd-c4-tabbed-header-renderer{background-color:transparent;}";
        document.body.appendChild(csselement);
        document.getElementsByTagName("html")[0].style.scrollbarColor = "#909090 #262536";
    } catch (error) {
        console.log(error);
    }
}
setInterval(changetheme, 2000);