var currentTheme = localStorage.getItem('theme');

console.log("loaded " + JSON.stringify(currentTheme));

var html = document.getElementsByTagName("html");
var body = document.body;
var divs = document.getElementsByTagName("div");
var links = document.getElementsByTagName("a");

let checkTheme = () =>
{
    console.log("checking theme, result: " + JSON.stringify(currentTheme));
    // check for previously set theme
    if (JSON.stringify(currentTheme) == "dark") 
    {
        for(let i = 0; i < html.length; i++)
        {
            html[i].classList.toggle("dark-mode");
        }

        body.classList.toggle("dark-mode");
        
        for(let i = 0; i < divs.length; i++)
        {
            divs[i].classList.toggle("dark-mode");
        }    
        for(let i = 0; i < links.length; i++)
        {
            links[i].classList.toggle("dark-mode");
        }
    } 
}
