File tree Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Original file line number Diff line number Diff line change 1111 sidebar . classList . toggle ( "hidden" ) ;
1212 }
1313 </ script >
14+ < script >
15+ const toggleDarkMode = ( ) => {
16+ document . body . classList . toggle ( 'dark-mode' ) ;
17+ localStorage . setItem ( 'dark-mode' , document . body . classList . contains ( 'dark-mode' ) ) ;
18+ } ;
19+
20+ window . onload = ( ) => {
21+ if ( localStorage . getItem ( 'dark-mode' ) === 'true' ) {
22+ document . body . classList . add ( 'dark-mode' ) ;
23+ }
24+ } ;
25+ </ script >
26+ < button onclick ="toggleDarkMode() " style ="position: fixed; top: 1rem; right: 1rem; "> 🌓</ button >
27+
1428 </ head >
1529 < body >
1630 < div class ="wrapper ">
2337 </ div >
2438 </ div >
2539 </ body >
26- </ html >
40+ </ html >
Original file line number Diff line number Diff line change 1+ /*
12body {
23 margin: 0;
34 font-family: 'Segoe UI', sans-serif;
@@ -56,3 +57,70 @@ body {
5657 z-index: 1000;
5758 border-radius: 5px;
5859}
60+
61+
62+ */
63+
64+ : root {
65+ --bg-color : # ffffff ;
66+ --text-color : # 000000 ;
67+ --sidebar-bg : # f8f9fa ;
68+ --link-color : # 0366d6 ;
69+ }
70+
71+ .dark-mode {
72+ --bg-color : # 121212 ;
73+ --text-color : # e0e0e0 ;
74+ --sidebar-bg : # 1f1f1f ;
75+ --link-color : # 90caf9 ;
76+ }
77+
78+ body {
79+ background-color : var (--bg-color );
80+ color : var (--text-color );
81+ }
82+
83+ .sidebar {
84+ background-color : var (--sidebar-bg );
85+ }
86+
87+ a {
88+ color : var (--link-color );
89+ }
90+
91+ .sidebar {
92+ width : 260px ;
93+ padding : 1rem ;
94+ position : fixed;
95+ height : 100vh ;
96+ overflow-y : auto;
97+ border-right : 1px solid # ccc ;
98+ transition : all 0.3s ease;
99+ }
100+
101+ .sidebar a {
102+ display : block;
103+ padding : 0.5rem ;
104+ margin-bottom : 0.5rem ;
105+ border-radius : 0.5rem ;
106+ text-decoration : none;
107+ }
108+
109+ .sidebar a : hover {
110+ background-color : rgba (0 , 0 , 0 , 0.05 );
111+ }
112+
113+ <style>
114+ .fade-in {
115+ animation : fadeIn 0.4s ease-in;
116+ }
117+
118+ @keyframes fadeIn {
119+ from { opacity : 0 ; transform : translateY (10px ); }
120+ to { opacity : 1 ; transform : translateY (0 ); }
121+ }
122+ </ style>
123+
124+ <div class= "content fade-in" >
125+ {{ content }}
126+ </ div>
You can’t perform that action at this time.
0 commit comments