switch theme and github buttons

This commit is contained in:
AngelJumbo
2024-06-03 13:39:21 -05:00
parent 0a3cdc17f2
commit 5992f48512
3 changed files with 78 additions and 23 deletions
+15
View File
@@ -35,3 +35,18 @@ function hideAll() {
s.style.display = "none";
});
}
function switchTheme(){
let currTheme = document.documentElement.style.getPropertyValue('color-scheme');
console.log(currTheme);
if (currTheme == "dark") {
document.getElementsByClassName("fa-sun")[0].style.display = "none";
document.getElementsByClassName("fa-moon")[0].style.display = "block";
document.documentElement.style.setProperty('color-scheme', 'light');
} else {
document.getElementsByClassName("fa-moon")[0].style.display = "none";
document.getElementsByClassName("fa-sun")[0].style.display = "block";
document.documentElement.style.setProperty('color-scheme', 'dark');
}
}