toggle-dark.js (418B)
1 function toggle_dark() { 2 var githubImage = document.getElementById('github'); 3 var toggleButton = document.getElementById('toggle_dark'); 4 if (document.body.classList.toggle('dark')) { 5 // is dark 6 githubImage.src = 'assets/github-mark-white.svg'; 7 toggleButton.innerHTML = ' licht aandoen '; 8 } else { 9 // is light 10 githubImage.src = 'assets/github-mark.svg'; 11 toggleButton.innerHTML = ' licht uitdoen '; 12 } 13 }