66 < title > tinystruct framework</ title >
77 < 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 " />
88 < style >
9+ : root {
10+ --background : # f5f5f5 ;
11+ --text : # 000000 ;
12+ }
13+
914 /* General Styles */
1015 body {
1116 font-family : 'Roboto' , Arial, sans-serif;
1217 margin : 0 ;
1318 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 ;
1622 }
1723
1824 /* Navigation Bar */
7682 box-shadow : 0 4px 10px rgba (0 , 0 , 0 , 0.1 );
7783 }
7884
85+ .dark .container , .dark nav , .dark button {
86+ background : # 000000 ;
87+ }
88+
89+ .dark li {
90+ background : black;
91+ }
92+
7993 h1 , h2 {
8094 color : # 4b3c6e ;
8195 }
218232 .language-select {
219233 margin : 0.5rem 0 ;
220234 }
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+ }
221244 }
222245
223246 .terminal {
264287 .urls a : hover {
265288 text-decoration : underline;
266289 }
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+ }
267357 </ style >
268358</ head >
269359< body >
@@ -272,11 +362,21 @@ <h1>
272362 < img src ="https://avatars.githubusercontent.com/u/3723144?s=48&v=4 " alt ="tinystruct logo ">
273363 tinystruct
274364 </ h1 >
365+
275366 < div class ="hamburger " onclick ="toggleMenu() ">
276367 < div > </ div >
277368 < div > </ div >
278369 < div > </ div >
279370 </ 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 >
280380 < div class ="menu ">
281381 < 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 >
282382 < a href ="#features " class ="lang " data-en ="Features " data-fr ="Caractéristiques " data-de ="Funktionen " data-zh ="特点 "> Features</ a >
@@ -289,6 +389,14 @@ <h1>
289389 < option value ="de "> Deutsch</ option >
290390 < option value ="zh "> 中文</ option >
291391 </ 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+
292400 </ div >
293401</ nav >
294402< div class ="container " id ="about ">
@@ -528,7 +636,7 @@ <h2 id="installation" class="lang" data-en="Installation and Getting Started" da
528636 typeMainCommands ( ) ;
529637
530638 // Check if DeviceMotion is supported
531- if ( window . DeviceMotionEvent ) {
639+ /* if (window.DeviceMotionEvent) {
532640 console.log("DeviceMotion is supported on this device.");
533641
534642 // Add an event listener for device motion
@@ -573,8 +681,25 @@ <h2 id="installation" class="lang" data-en="Installation and Getting Started" da
573681 } else {
574682 console.log("DeviceMotion is not supported on this device.");
575683 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' ) ;
576692 }
577693
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+
578703</ script >
579704</ body >
580705</ html >
0 commit comments