<button onclick="test()" class="theme-button bx bx-moon" id="theme-button"></button>
var btn = document.getElementById("theme-button");
var link = document.getElementById("theme-link");
btn.addEventListener("click", function () { ChangeTheme(); });
function ChangeTheme()
{
let lightTheme = "styles/light.css";
let darkTheme = "styles/dark.css";
var currTheme = link.getAttribute("href");
var theme = "";
if(currTheme == lightTheme)
{
currTheme = darkTheme;
theme = "dark";
}
else
{
currTheme = lightTheme;
theme = "light";
}
link.setAttribute("href", currTheme);
}
function test() {
if(btn.classList.contains('bx-moon')){
btn.classList.remove('bx-moon')
btn.classList.add('bx-sun')
btn.classList.add('bx')
}
if(btn.classList.contains('bx-sun')){
btn.classList.remove('bx-sun')
btn.classList.add('bx-moon')
btn.classList.add('bx')
}
}