6
6
< title > tinystruct framework</ title >
7
7
< link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css " integrity ="sha512-tN7Ec6zAFaVSG3TpNAKtk4DOHNpSwKHxxrsiw4GHKESGPs5njn/0sMCUMl2svV4wo4BK/rCP7juYz+zx+l6oeQ== " crossorigin ="anonymous " referrerpolicy ="no-referrer " />
8
8
< style >
9
+ : root {
10
+ --background : # f5f5f5 ;
11
+ --text : # 000000 ;
12
+ }
13
+
9
14
/* General Styles */
10
15
body {
11
16
font-family : 'Roboto' , Arial, sans-serif;
12
17
margin : 0 ;
13
18
padding : 0 ;
14
- background-color : # f5f5f5 ;
15
- color : # 333 ;
19
+ background-color : var (--background );
20
+ color : var (--text );
21
+ transition : background-color 0.3s , color 0.3s ;
16
22
}
17
23
18
24
/* Navigation Bar */
76
82
box-shadow : 0 4px 10px rgba (0 , 0 , 0 , 0.1 );
77
83
}
78
84
85
+ .dark .container , .dark nav , .dark button {
86
+ background : # 000000 ;
87
+ }
88
+
89
+ .dark li {
90
+ background : black;
91
+ }
92
+
79
93
h1 , h2 {
80
94
color : # 4b3c6e ;
81
95
}
218
232
.language-select {
219
233
margin : 0.5rem 0 ;
220
234
}
235
+
236
+ .hamburger {
237
+ order : 1 ; /* Keep hamburger on the right */
238
+ }
239
+
240
+ nav button {
241
+ margin-right : 10px ;
242
+ order : 0 ; /* Move the theme toggle button first */
243
+ }
221
244
}
222
245
223
246
.terminal {
264
287
.urls a : hover {
265
288
text-decoration : underline;
266
289
}
290
+
291
+ .dark {
292
+ --background : # 121212 ;
293
+ --text : # f5f5f5 ;
294
+ }
295
+
296
+ .w-5 {
297
+ width : 2.0rem ;
298
+ }
299
+ .h-5 {
300
+ height : 2.0rem ;
301
+ }
302
+
303
+ .dark\:hidden : is (.dark * ) {
304
+ display : none;
305
+ }
306
+
307
+ .dark\:block : is (.dark * ) {
308
+ display : block;
309
+ }
310
+
311
+ .dark\:hover\:bg-white\/ 5: hover: is (.dark * ) {
312
+ background-color : hsla (0 , 0% , 100% , .05 );
313
+ }
314
+
315
+ .hover\:bg-zinc-900\/ 5: hover {
316
+ background-color : rgba (24 , 24 , 27 , .05 );
317
+ }
318
+
319
+ .stroke-white {
320
+ stroke : # fff ;
321
+ }
322
+
323
+ .stroke-zinc-900 {
324
+ stroke : # 18181b ;
325
+ }
326
+
327
+ .hidden {
328
+ display : none;
329
+ }
330
+
331
+ .transition {
332
+ transition-property : color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
333
+ transition-property : color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
334
+ transition-property : color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
335
+ transition-timing-function : cubic-bezier (.4 , 0 , .2 , 1 );
336
+ transition-duration : .15s ;
337
+ }
338
+ .rounded-md {
339
+ border : 0 solid;
340
+ border-radius : .375rem ;
341
+ }
342
+ .justify-center {
343
+ justify-content : center;
344
+ }
345
+ .items-center {
346
+ align-items : center;
347
+ }
348
+ .w-6 {
349
+ width : 2.0rem ;
350
+ }
351
+ .h-6 {
352
+ height : 2.0rem ;
353
+ }
354
+ .flex {
355
+ display : flex;
356
+ }
267
357
</ style >
268
358
</ head >
269
359
< body >
@@ -272,11 +362,21 @@ <h1>
272
362
< img src ="https://avatars.githubusercontent.com/u/3723144?s=48&v=4 " alt ="tinystruct logo ">
273
363
tinystruct
274
364
</ h1 >
365
+
275
366
< div class ="hamburger " onclick ="toggleMenu() ">
276
367
< div > </ div >
277
368
< div > </ div >
278
369
< div > </ div >
279
370
</ div >
371
+ < button type ="button " class ="flex h-6 w-6 items-center justify-center rounded-md transition hover:bg-zinc-900/5 dark:hover:bg-white/5 " aria-label ="Switch to light theme " onclick ="toggleTheme() ">
372
+ < svg viewBox ="0 0 20 20 " fill ="none " aria-hidden ="true " class ="h-5 w-5 stroke-zinc-900 dark:hidden ">
373
+ < path d ="M12.5 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z "> </ path >
374
+ < path stroke-linecap ="round " d ="M10 5.5v-1M13.182 6.818l.707-.707M14.5 10h1M13.182 13.182l.707.707M10 15.5v-1M6.11 13.889l.708-.707M4.5 10h1M6.11 6.111l.708.707 "> </ path >
375
+ </ svg >
376
+ < svg viewBox ="0 0 20 20 " fill ="none " aria-hidden ="true " class ="hidden h-5 w-5 stroke-white dark:block ">
377
+ < path d ="M15.224 11.724a5.5 5.5 0 0 1-6.949-6.949 5.5 5.5 0 1 0 6.949 6.949Z "> </ path >
378
+ </ svg >
379
+ </ button >
280
380
< div class ="menu ">
281
381
< a href ="#about " class ="lang " data-en ="What is tinystruct? " data-fr ="Qu'est-ce que tinystruct? " data-de ="Was ist tinystruct? " data-zh ="什么是 tinystruct? "> What is tinystruct?</ a >
282
382
< a href ="#features " class ="lang " data-en ="Features " data-fr ="Caractéristiques " data-de ="Funktionen " data-zh ="特点 "> Features</ a >
@@ -289,6 +389,14 @@ <h1>
289
389
< option value ="de "> Deutsch</ option >
290
390
< option value ="zh "> 中文</ option >
291
391
</ select >
392
+
393
+ < a href ="https://github.com/tinystruct/tinystruct " target ="_blank " class ="github-star " title ="Star tinystruct on GitHub ">
394
+ < svg xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 24 24 " fill ="currentColor " aria-hidden ="true " width ="16 " height ="16 ">
395
+ < path d ="M12 .587l3.668 7.435 8.2 1.19-5.934 5.787 1.4 8.169L12 18.896l-7.334 3.872 1.4-8.169L.132 9.212l8.2-1.19L12 .587z "/>
396
+ </ svg >
397
+ Star us on Github
398
+ </ a >
399
+
292
400
</ div >
293
401
</ nav >
294
402
< div class ="container " id ="about ">
@@ -528,7 +636,7 @@ <h2 id="installation" class="lang" data-en="Installation and Getting Started" da
528
636
typeMainCommands ( ) ;
529
637
530
638
// Check if DeviceMotion is supported
531
- if ( window . DeviceMotionEvent ) {
639
+ /* if (window.DeviceMotionEvent) {
532
640
console.log("DeviceMotion is supported on this device.");
533
641
534
642
// Add an event listener for device motion
@@ -573,8 +681,25 @@ <h2 id="installation" class="lang" data-en="Installation and Getting Started" da
573
681
} else {
574
682
console.log("DeviceMotion is not supported on this device.");
575
683
alert("Your device does not support DeviceMotion.");
684
+ }*/
685
+
686
+ function toggleTheme ( ) {
687
+ // Toggle the 'dark' class on the <html> element
688
+ document . documentElement . classList . toggle ( 'dark' ) ;
689
+ // Optionally save the current theme to localStorage for persistence
690
+ const isDark = document . documentElement . classList . contains ( 'dark' ) ;
691
+ localStorage . setItem ( 'theme' , isDark ? 'dark' : 'light' ) ;
576
692
}
577
693
694
+ // Initialize theme on page load
695
+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
696
+ const savedTheme = localStorage . getItem ( 'theme' ) ;
697
+ if ( savedTheme === 'dark' ) {
698
+ document . documentElement . classList . add ( 'dark' ) ;
699
+ }
700
+ } ) ;
701
+
702
+
578
703
</ script >
579
704
</ body >
580
705
</ html >
0 commit comments