Skip to content

Commit 1c8f66f

Browse files
Introduce dark mode
1 parent 90941d9 commit 1c8f66f

File tree

4 files changed

+105
-3
lines changed

4 files changed

+105
-3
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ but is entirely independent.
2828
2929
- Now go to the repository "Settings" then click "Pages" on the left and select
3030
"Github Actions" instead of "Deploy from a branch" for "Source".
31-
31+
3232
<img width="837" alt="Screenshot 2024-11-27 at 16 51 07" src="https://github.com/user-attachments/assets/7219187c-7370-42dd-a9cf-c7559072b42f">
3333

3434
<img width="304" alt="Screenshot 2024-11-27 at 16 52 45" src="https://github.com/user-attachments/assets/9af6698f-2c47-422f-8dff-61ee3629089e">
@@ -82,10 +82,16 @@ We give the semantics of the various fields (all of whom are optional).
8282
- `pronouns`: A string to show your pronouns.
8383

8484
- `footer`: Some data to put in the footer of the page. You can use it to put
85-
some disclaimer, or maybe to advertise basicpage. ☺️
85+
some disclaimer, or maybe to advertise `basicpage`. ☺️
8686
If nothing is provided, then the footer doesn't appear, and thus the
8787
horizontal that precedes is will not show either.
8888

89+
- `disable-dark-mode`: A Boolean deciding whether the page automatically
90+
switches to dark mode based on browser settings. It will load the `dark.css`
91+
CSS file.
92+
By default, this setting is `false`, meaning dark mode will automatically
93+
activate.
94+
8995
### OpenGraph
9096

9197
OpenGraph carries information that used by social media and messaging app to

pandoc/template.html4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
$for(css)$
3636
<link rel="stylesheet" href="$css$">
3737
$endfor$
38+
$if(disable-dark-mode)$$else$
39+
<link rel="stylesheet" href="dark.css">
40+
$endif$
3841
$if(og-picture)$
3942
<meta property="og:image" content="$og-picture$">
4043
$endif$

src/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ clickable-email: false
1010
picture: img/profile.png
1111
picture-round: false
1212
side-by-side: true
13+
disable-dark-mode: false
1314
pronouns: They/Them
1415
og-picture: https://basicpage.github.io/img/profile.png
1516
orcid: 0000-0000-0000-0000
@@ -69,7 +70,7 @@ My workflow is usually to use <kbd>Ctrl</kbd> + <kbd>C</kbd> /
6970
``` yaml {.paper}
7071
title: Yet another yaml parser 3
7172
authors: Templato Urnehm
72-
awards:
73+
awards:
7374
- Yet another "Yet another" award
7475
- Never-ending Work Award
7576
venue: Proceedings of Nihilism

website/dark.css

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
3+
bg: #1c1d1f
4+
icons: #739fe7
5+
links: #d1beb3
6+
award-bg: #2e2813
7+
award: #cf9c10
8+
9+
*/
10+
11+
@media (prefers-color-scheme: dark) {
12+
body {
13+
background-color: #424242;
14+
color: #f4ebdb;
15+
}
16+
17+
a {
18+
color: #91c1ff;
19+
}
20+
21+
div.tip {
22+
border-left: 4px solid #45df45;
23+
padding-left: 10px;
24+
}
25+
26+
div.tip > div.title p {
27+
color: #45df45;
28+
}
29+
30+
div.important {
31+
border-left: 4px solid rgb(192, 51, 228);
32+
}
33+
34+
div.important > div.title p {
35+
color: rgb(192, 51, 228);
36+
}
37+
38+
div.warning {
39+
border-left: 4px solid rgb(255, 203, 99);
40+
}
41+
42+
div.warning > div.title p {
43+
color: rgb(255, 203, 99);
44+
}
45+
46+
div.caution {
47+
border-left: 4px solid rgb(255, 104, 134);
48+
}
49+
50+
div.caution > div.title p {
51+
color: rgb(255, 104, 134);
52+
}
53+
54+
div.note {
55+
border-left: 4px solid #7799ff;
56+
}
57+
58+
div.note > div.title p {
59+
color: #7799ff;
60+
}
61+
62+
pre {
63+
background-color: #070707;
64+
}
65+
66+
nav ul li a {
67+
color: #d1beb3;
68+
border-bottom-color: #d1beb3;
69+
}
70+
71+
nav ul li a:hover {
72+
color: #d1beb3;
73+
border-bottom-color: #d1beb3;
74+
}
75+
76+
table tr {
77+
background-color: #414141;
78+
}
79+
80+
table tr:nth-child(2n) {
81+
background-color: #4e4e4e;
82+
}
83+
84+
section.paper p {
85+
color: rgb(189, 189, 189);
86+
}
87+
88+
div.awards span {
89+
background: #2e2813;
90+
color: #cf9c10;
91+
}
92+
}

0 commit comments

Comments
 (0)