New Page  |  Edit Page

 

Darkmode


function loadTheme() {
    
    var theme = localStorage.getItem('theme');
    var dataTheme = localStorage.getItem('theme');

    if(dataTheme === 'dark') {
        document.getElementById('light-theme').setAttribute('href', "./app/style/dark.css");
    } else {
        document.getElementById('light-theme').setAttribute('href', "./app/style/light.css");
    } 
    
}

function toggleDarkMode() {

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

    if(dataTheme === 'dark') {
        localStorage.setItem("theme", "light");
        document.getElementById('light-theme').setAttribute('href', "./app/style/light.css");
    } else {
        localStorage.setItem("theme", "dark");
        document.getElementById('light-theme').setAttribute('href', "./app/style/dark.css");
    }
    
}

function toggleTheme(toggleSheet){
    document.getElementById('light-theme').setAttribute('href', toggleSheet);  
}

function swapTheme(){
   let currentTheme = document.getElementById('light-theme').getAttribute('href');
   if(currentTheme == "./app/style/light.css")
       document.getElementById('light-theme').setAttribute('href', "./app/style/dark.css");
   else
       document.getElementById('light-theme').setAttribute('href', "./app/style/light.css");
}
Toggle Dark Mode