(theme)
| 17 | |
| 18 | // Apply theme and update UI |
| 19 | function applyTheme(theme) { |
| 20 | document.documentElement.setAttribute('data-theme', theme); |
| 21 | const btn = document.getElementById('theme-btn'); |
| 22 | if (btn) { |
| 23 | const moonIcon = btn.querySelector('.icon-moon'); |
| 24 | const sunIcon = btn.querySelector('.icon-sun'); |
| 25 | if (moonIcon) moonIcon.style.display = theme === 'dark' ? 'none' : ''; |
| 26 | if (sunIcon) sunIcon.style.display = theme === 'dark' ? '' : 'none'; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | // Toggle theme and save preference. Returns the new theme. |
| 31 | function toggleAndSaveTheme() { |
no test coverage detected
searching dependent graphs…