ref: master
layouts/baseof.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!doctype html> <html lang="{{ .Lang }}"> {{ partial "head.html" . }} <body> {{ block "main" . }}{{ end }} <script> (function () { var root = document.documentElement; var button = document.getElementById('theme-toggle'); var label = document.getElementById('theme-label'); if (!button || !label) return; label.textContent = root.classList.contains('dark') ? 'dark' : 'light'; button.addEventListener('click', function () { var dark = root.classList.toggle('dark'); label.textContent = dark ? 'dark' : 'light'; localStorage.setItem('theme', dark ? 'dark' : 'light'); }); })(); </script> </body> </html> |