Skip to content

Commit 9a5e411

Browse files
committed
Updated
1 parent cbca652 commit 9a5e411

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

site/_layouts/default.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
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">
@@ -23,4 +37,4 @@
2337
</div>
2438
</div>
2539
</body>
26-
</html>
40+
</html>

site/assets/style.css

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*
12
body {
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>

0 commit comments

Comments
 (0)