@@ -49,11 +49,27 @@ const navItems = [
4949 }
5050 <li >
5151 <button id =" theme-toggle" class =" theme-toggle" aria-label =" Toggle dark mode" >
52- <svg id =" sun-icon" class =" theme-icon" fill =" currentColor" viewBox =" 0 0 20 20" aria-hidden =" true" >
53- <path fill-rule =" evenodd" d =" M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" clip-rule =" evenodd" ></path >
52+ <svg
53+ id =" sun-icon"
54+ class =" theme-icon"
55+ fill =" currentColor"
56+ viewBox =" 0 0 20 20"
57+ aria-hidden =" true"
58+ >
59+ <path
60+ fill-rule =" evenodd"
61+ d =" M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"
62+ clip-rule =" evenodd" ></path >
5463 </svg >
55- <svg id =" moon-icon" class =" theme-icon" fill =" currentColor" viewBox =" 0 0 20 20" aria-hidden =" true" >
56- <path d =" M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" ></path >
64+ <svg
65+ id =" moon-icon"
66+ class =" theme-icon"
67+ fill =" currentColor"
68+ viewBox =" 0 0 20 20"
69+ aria-hidden =" true"
70+ >
71+ <path d =" M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"
72+ ></path >
5773 </svg >
5874 </button >
5975 </li >
@@ -83,7 +99,7 @@ const navItems = [
8399 const html = document.documentElement;
84100 const sunIcon = document.getElementById('sun-icon');
85101 const moonIcon = document.getElementById('moon-icon');
86-
102+
87103 function updateIcons() {
88104 if (html.classList.contains('dark')) {
89105 sunIcon.style.display = 'block';
@@ -93,21 +109,24 @@ const navItems = [
93109 moonIcon.style.display = 'block';
94110 }
95111 }
96-
112+
97113 function toggleTheme() {
98114 html.classList.toggle('dark');
99115 localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light');
100116 updateIcons();
101117 }
102-
118+
103119 // Initialize theme from localStorage or system preference
104- if (localStorage.getItem('theme') === 'dark' ||
105- (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
120+ if (
121+ localStorage.getItem('theme') === 'dark' ||
122+ (!localStorage.getItem('theme') &&
123+ window.matchMedia('(prefers-color-scheme: dark)').matches)
124+ ) {
106125 html.classList.add('dark');
107126 }
108-
127+
109128 updateIcons();
110-
129+
111130 themeToggle.addEventListener('click', toggleTheme);
112131 </script >
113132 </body >
@@ -125,7 +144,9 @@ const navItems = [
125144 background: color-mix(in srgb, var(--color-bg-primary) 95%, transparent);
126145 border-bottom: 1px solid var(--color-border-subtle);
127146 backdrop-filter: blur(8px);
128- transition: background-color 0.3s ease, border-color 0.3s ease;
147+ transition:
148+ background-color 0.3s ease,
149+ border-color 0.3s ease;
129150 }
130151
131152 html.dark .site-header {
0 commit comments