12
12
--text-color : # 1a2634 ;
13
13
--subtle-color : # 6c7a89 ;
14
14
--grid-color : rgba (0 , 0 , 0 , 0.06 );
15
+ --container-bg : white;
16
+ --link-hover : # 2d3e50 ;
17
+ }
18
+
19
+ @media (prefers-color-scheme : dark) {
20
+ : root {
21
+ --primary-color : # e1e1e1 ;
22
+ --accent-color : # a8b9cc ;
23
+ --background-color : # 1a1a1a ;
24
+ --text-color : # e1e1e1 ;
25
+ --subtle-color : # 888 ;
26
+ --grid-color : rgba (255 , 255 , 255 , 0.06 );
27
+ --container-bg : # 1a1a1a ;
28
+ --link-hover : # a8b9cc ;
29
+ }
30
+ }
31
+
32
+ /* Light theme (default) */
33
+ : root [data-theme = "light" ] {
34
+ --primary-color : # 1a2634 ;
35
+ --accent-color : # 2d3e50 ;
36
+ --background-color : # f8f9fa ;
37
+ --text-color : # 1a2634 ;
38
+ --subtle-color : # 6c7a89 ;
39
+ --grid-color : rgba (0 , 0 , 0 , 0.06 );
40
+ --container-bg : white;
41
+ --link-hover : # 2d3e50 ;
42
+ }
43
+
44
+ /* Dark theme */
45
+ : root [data-theme = "dark" ] {
46
+ --primary-color : # e1e1e1 ;
47
+ --accent-color : # a8b9cc ;
48
+ --background-color : # 1a1a1a ;
49
+ --text-color : # e1e1e1 ;
50
+ --subtle-color : # 888 ;
51
+ --grid-color : rgba (255 , 255 , 255 , 0.06 );
52
+ --container-bg : # 1a1a1a ;
53
+ --link-hover : # a8b9cc ;
15
54
}
16
55
17
56
body {
18
- font-family : system-ui , -apple-system , BlinkMacSystemFont , 'Segoe UI ' , Roboto , 'Helvetica Neue ', Arial , sans-serif ;
57
+ font-family : ui-monospace , 'Cascadia Code' , 'Source Code Pro ' , Menlo , Consolas , 'DejaVu Sans Mono ', monospace ;
19
58
line-height : 1.6 ;
20
59
max-width : 700px ;
21
60
margin : 40px auto;
26
65
linear-gradient (to right, var (--grid-color ) 1px , transparent 1px ),
27
66
linear-gradient (to bottom, var (--grid-color ) 1px , transparent 1px );
28
67
background-size : 16px 16px ;
29
- font-size : 15px ;
68
+ font-size : 14px ;
69
+ transition : color 0.3s ease, background-color 0.3s ease;
30
70
}
31
71
32
72
.container {
33
- background : white ;
73
+ background : var ( --container-bg ) ;
34
74
padding : 40px ;
35
75
box-shadow : 0 0 40px rgba (0 , 0 , 0 , 0.05 );
36
- border : 1px solid rgba (0 , 0 , 0 , 0.12 );
76
+ border : 1px solid var (--grid-color );
77
+ transition : background-color 0.3s ease, border-color 0.3s ease;
37
78
}
38
79
39
80
@media (max-width : 600px ) {
40
81
body {
41
82
margin : 0 ;
42
83
padding : 0 ;
43
- background : white ;
84
+ background : var ( --container-bg ) ;
44
85
}
45
86
.container {
46
87
padding : 20px ;
67
108
border-bottom : 1px solid var (--grid-color );
68
109
padding-bottom : 0.3em ;
69
110
margin-top : 1.5em ;
111
+ transition : border-color 0.3s ease;
70
112
}
71
113
72
114
.company {
95
137
}
96
138
97
139
.links a : hover {
98
- color : var (--accent-color );
140
+ color : var (--link-hover );
99
141
}
100
142
101
143
.content a , .company a {
106
148
}
107
149
108
150
.content a : hover , .company a : hover {
109
- color : var (--accent-color );
151
+ color : var (--link-hover );
110
152
}
111
153
112
154
.tooltip {
115
157
top : 50% ;
116
158
transform : translate (-50% , -50% );
117
159
background : var (--accent-color );
118
- color : white ;
160
+ color : var ( --container-bg ) ;
119
161
padding : 8px 16px ;
120
162
border-radius : 3px ;
121
163
font-size : 13px ;
126
168
white-space : nowrap;
127
169
}
128
170
171
+ .footer {
172
+ display : flex;
173
+ justify-content : space-between;
174
+ align-items : center;
175
+ margin-top : 40px ;
176
+ border-top : 1px solid var (--grid-color );
177
+ padding-top : 20px ;
178
+ transition : border-color 0.3s ease;
179
+ }
180
+
129
181
.last-updated {
130
182
color : var (--subtle-color );
131
183
font-size : 0.9em ;
132
- margin-top : 40px ;
133
- text-align : right;
134
184
font-style : italic;
135
- border-top : 1px solid var (--grid-color );
136
- padding-top : 20px ;
185
+ }
186
+
187
+ .theme-toggle {
188
+ cursor : pointer;
189
+ user-select : none;
190
+ font-size : 1.2em ;
137
191
}
138
192
139
193
p {
@@ -172,13 +226,16 @@ <h2>Links</h2>
172
226
< div > < a href ="resume.pdf " target ="_blank "> 📄 Resume</ a > </ div >
173
227
</ div >
174
228
175
- < div class ="last-updated "> Last Updated: November 2024</ div >
229
+ < div class ="footer ">
230
+ < div class ="last-updated "> Last Updated: November 2024</ div >
231
+ < div class ="theme-toggle "> ☀️</ div >
232
+ </ div >
176
233
</ div >
177
234
178
235
< div class ="tooltip " id ="tooltip "> Copied to clipboard!</ div >
179
236
180
237
< script >
181
- // Only handle clipboard for email
238
+ // Email clipboard functionality
182
239
document . querySelectorAll ( 'a[data-clipboard]' ) . forEach ( link => {
183
240
link . addEventListener ( 'click' , ( e ) => {
184
241
e . preventDefault ( ) ;
@@ -194,6 +251,41 @@ <h2>Links</h2>
194
251
} , 1000 ) ;
195
252
} ) ;
196
253
} ) ;
254
+
255
+ // Theme toggle
256
+ const themeToggle = document . querySelector ( '.theme-toggle' ) ;
257
+ const root = document . documentElement ;
258
+
259
+ // Function to check if system is in dark mode
260
+ const systemPrefersDark = ( ) =>
261
+ window . matchMedia && window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
262
+
263
+ // Function to set theme
264
+ const setTheme = ( isDark ) => {
265
+ if ( isDark ) {
266
+ root . setAttribute ( 'data-theme' , 'dark' ) ;
267
+ themeToggle . textContent = '🌙' ;
268
+ localStorage . setItem ( 'theme' , 'dark' ) ;
269
+ } else {
270
+ root . setAttribute ( 'data-theme' , 'light' ) ;
271
+ themeToggle . textContent = '☀️' ;
272
+ localStorage . setItem ( 'theme' , 'light' ) ;
273
+ }
274
+ } ;
275
+
276
+ // Initialize theme based on localStorage or system preference
277
+ const storedTheme = localStorage . getItem ( 'theme' ) ;
278
+ if ( storedTheme ) {
279
+ setTheme ( storedTheme === 'dark' ) ;
280
+ } else {
281
+ setTheme ( systemPrefersDark ( ) ) ;
282
+ }
283
+
284
+ // Toggle theme on click
285
+ themeToggle . addEventListener ( 'click' , ( ) => {
286
+ const isDark = root . getAttribute ( 'data-theme' ) === 'dark' ;
287
+ setTheme ( ! isDark ) ;
288
+ } ) ;
197
289
</ script >
198
290
</ body >
199
291
</ html >
0 commit comments