Docs rework (#21)
* wip * docs reworked * reworked docs * updated docs and pipeline --------- Co-authored-by: ex61wi <tim.rorije@ing.com> Co-authored-by: dutchie032 <dutchie032>
This commit is contained in:
committed by
GitHub
co-authored by
ex61wi
dutchie032 <dutchie032>
parent
28993c98b4
commit
5db860a7a2
@@ -0,0 +1,22 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const themeToggle = document.getElementById('theme-toggle');
|
||||
const sunIcon = document.getElementById('sun-icon');
|
||||
const moonIcon = document.getElementById('moon-icon');
|
||||
if (!themeToggle || !sunIcon || !moonIcon) return;
|
||||
|
||||
function setTheme(theme) {
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
localStorage.setItem('theme', theme);
|
||||
sunIcon.style.display = theme === 'light' ? 'block' : 'none';
|
||||
moonIcon.style.display = theme === 'light' ? 'none' : 'block';
|
||||
}
|
||||
|
||||
themeToggle.addEventListener('click', function() {
|
||||
const current = document.documentElement.getAttribute('data-theme') || 'dark';
|
||||
setTheme(current === 'dark' ? 'light' : 'dark');
|
||||
});
|
||||
|
||||
// Initialize
|
||||
const saved = localStorage.getItem('theme') || 'dark';
|
||||
setTheme(saved);
|
||||
});
|
||||
Reference in New Issue
Block a user