Skip to content

Commit 2f1e79c

Browse files
committed
Add color scheme support for links and code blocks
1 parent 5573ab6 commit 2f1e79c

File tree

1 file changed

+50
-13
lines changed

1 file changed

+50
-13
lines changed

assets/css/post.css

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100;0,300;0,400;0,800;1,100;1,300;1,400;1,800&display=swap");
22

3-
:root {
4-
--gray-1: #3f3f3f;
5-
--gray-2: #32353a;
6-
--gray-3: #25282c;
7-
--gray-4: #151618;
8-
--gray-5: #151618;
9-
--gray-6: #111111;
10-
--white-1: #eeeeee;
11-
--white-2: #a9abb3;
12-
}
133
* {
144
font-family: inherit;
155
text-decoration: none;
@@ -34,8 +24,31 @@ body {
3424
color: cyan;
3525
border-bottom: 1px solid cyan;
3626
}
27+
@media (prefers-color-scheme: light) {
28+
.content a {
29+
color: #1ebaba;
30+
border-bottom: 1px solid #1ebaba;
31+
}
32+
}
33+
[data-theme="light"] {
34+
.content a {
35+
color: #1ebaba;
36+
border-bottom: 1px solid #1ebaba;
37+
}
38+
}
39+
[data-theme="dark"] {
40+
.content a {
41+
color: cyan;
42+
border-bottom: 1px solid cyan;
43+
}
44+
}
3745
header {
3846
padding: 2rem 0 4rem 0;
47+
display: flex;
48+
flex-direction: row;
49+
align-items: flex-start;
50+
justify-content: space-between;
51+
gap: 1rem;
3952
}
4053
.site-title {
4154
font-size: 1.4rem;
@@ -161,7 +174,7 @@ main {
161174
margin: 1rem 0;
162175
}
163176
.content img.emoji {
164-
margin: 0 !important;
177+
margin: 0 !important;
165178
}
166179

167180
/* pre , code */
@@ -173,7 +186,7 @@ main {
173186
}
174187

175188
.content pre {
176-
background: var(--gray-3) !important;
189+
background: var(--gray-3);
177190
padding: 1rem 2rem;
178191
margin-bottom: 1.75rem;
179192
}
@@ -182,7 +195,31 @@ main {
182195
padding: 3px 5px;
183196
color: var(--white-2);
184197
white-space: pre;
185-
background-color: var(--gray-3);
198+
background: var(--gray-3);
199+
}
200+
201+
@media (prefers-color-scheme: light) {
202+
.content code,
203+
.content pre {
204+
color: var(--gray-5);
205+
background: var(--gray-2_5) !important;
206+
}
207+
}
208+
209+
[data-theme="light"] {
210+
.content code,
211+
.content pre {
212+
color: var(--gray-5);
213+
background: var(--gray-2_5) !important;
214+
}
215+
}
216+
217+
[data-theme="dark"] {
218+
.content code,
219+
.content pre {
220+
color: var(--white-2);
221+
background: var(--gray-3);
222+
}
186223
}
187224

188225
/* lbox */

0 commit comments

Comments
 (0)