Skip to content

Commit afa8e41

Browse files
authored
Merge pull request #12 from GustyCube/copilot/add-dark-light-theme-toggle
Add dark/light theme toggle with localStorage persistence
2 parents 150c145 + 5cd73d9 commit afa8e41

File tree

3 files changed

+207
-45
lines changed

3 files changed

+207
-45
lines changed

frontend/css/styles.css

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@
2424
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
2525
}
2626

27+
/* Light theme variables */
28+
:root[data-theme="light"] {
29+
--bg-void: #ffffff;
30+
--bg-panel: #f5f5f5;
31+
--text-primary: #1a1a1a;
32+
--text-muted: #666666;
33+
34+
--accent-signal: #00c853;
35+
--accent-error: #d32f2f;
36+
--accent-haze: #00c85320;
37+
38+
--border-dim: #e0e0e0;
39+
--border-bright: #cccccc;
40+
}
41+
2742
/* RESET & BASE */
2843
*,
2944
*::before,
@@ -62,6 +77,10 @@ body {
6277
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.5'/%3E%3C/svg%3E");
6378
}
6479

80+
:root[data-theme="light"] .noise-overlay {
81+
opacity: 0.02;
82+
}
83+
6584
.erreval-haze {
6685
position: fixed;
6786
top: -50%;
@@ -117,6 +136,10 @@ a:hover {
117136
/* Highest */
118137
}
119138

139+
:root[data-theme="light"] .site-header {
140+
background: rgba(255, 255, 255, 0.85);
141+
}
142+
120143
.logo-type {
121144
font-size: 4rem;
122145
line-height: 0.8;
@@ -154,6 +177,35 @@ a:hover {
154177
.site-nav {
155178
display: flex;
156179
gap: 2rem;
180+
align-items: center;
181+
}
182+
183+
/* Theme Toggle Button */
184+
.theme-toggle {
185+
background: transparent;
186+
border: 1px solid var(--border-dim);
187+
color: var(--text-primary);
188+
cursor: pointer;
189+
padding: 0.5rem;
190+
font-family: var(--font-mono);
191+
font-size: 0.8rem;
192+
transition: all 0.3s var(--ease-out-expo);
193+
display: flex;
194+
align-items: center;
195+
justify-content: center;
196+
width: 36px;
197+
height: 36px;
198+
border-radius: 4px;
199+
}
200+
201+
.theme-toggle:hover {
202+
border-color: var(--accent-signal);
203+
color: var(--accent-signal);
204+
}
205+
206+
.theme-toggle svg {
207+
width: 18px;
208+
height: 18px;
157209
}
158210

159211
.nav-link {
@@ -356,6 +408,10 @@ select:focus {
356408
background-color: #ffffff;
357409
}
358410

411+
:root[data-theme="light"] .legend-dot.white {
412+
background-color: #1a1a1a;
413+
}
414+
359415
.legend-dot.grey {
360416
background-color: var(--text-muted);
361417
}

frontend/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ <h1 class="logo-type">ERR-EVAL</h1>
4343
</path>
4444
</svg>
4545
</a>
46+
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme">
47+
<svg viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" fill="none"
48+
stroke-linecap="round" stroke-linejoin="round">
49+
<path class="sun-icon" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" style="display: none;"></path>
50+
<path class="moon-icon" d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
51+
</svg>
52+
</button>
4653
</nav>
4754
</header>
4855

0 commit comments

Comments
 (0)