commit 2ace40ff6afa99e260547fd8391a0dd3a6cbca73
parent 2b5ee7e03c4c07f39de11b31bcdfc2c345510a47
Author: gracefu <81774659+gracefuu@users.noreply.github.com>
Date: Sat, 3 May 2025 00:49:00 +0800
Use custom style files
Diffstat:
| A | index-style.css | | | 154 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | make.py | | | 4 | +++- |
| A | style.css | | | 185 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3 files changed, 342 insertions(+), 1 deletion(-)
diff --git a/index-style.css b/index-style.css
@@ -0,0 +1,154 @@
+body {
+ color: #000;
+ background-color: #fff;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ font-size: 1em;
+ margin: 0;
+}
+
+img, svg, h1, h2 {
+ vertical-align: middle;
+}
+
+img {
+ border: 0;
+}
+
+a:target {
+ background-color: #ccc;
+}
+
+a.d,
+a.h,
+a.i,
+a.line {
+ text-decoration: none;
+}
+
+#blob a {
+ color: #555;
+}
+
+#blob a:hover {
+ color: blue;
+ text-decoration: none;
+}
+
+table thead td {
+ font-weight: bold;
+}
+
+table td {
+ padding: 0 0.4em;
+}
+
+#content table td {
+ vertical-align: top;
+ white-space: nowrap;
+}
+
+#branches tr:hover td,
+#tags tr:hover td,
+#index tr:hover td,
+#log tr:hover td,
+#files tr:hover td {
+ background-color: #eee;
+}
+
+#index tr td:nth-child(2),
+#tags tr td:nth-child(3),
+#branches tr td:nth-child(3),
+#log tr td:nth-child(2) {
+ white-space: normal;
+}
+
+td.num {
+ text-align: right;
+}
+
+.desc {
+ color: #555;
+}
+
+hr {
+ border: 0;
+ border-top: 1px solid #555;
+ height: 1px;
+}
+
+pre {
+ font-family: monospace;
+}
+
+pre a.h {
+ color: #00a;
+}
+
+.A,
+span.i,
+pre a.i {
+ color: #070;
+}
+
+.D,
+span.d,
+pre a.d {
+ color: #e00;
+}
+
+pre a.h:hover,
+pre a.i:hover,
+pre a.d:hover {
+ text-decoration: none;
+}
+
+@media (prefers-color-scheme: dark) {
+ body {
+ background-color: #000;
+ color: #bdbdbd;
+ }
+ hr {
+ border-color: #222;
+ }
+ a {
+ color: #56c8ff;
+ }
+ a:target {
+ background-color: #222;
+ }
+ .desc {
+ color: #aaa;
+ }
+ #blob a {
+ color: #555;
+ }
+ #blob a:target {
+ color: #eee;
+ }
+ #blob a:hover {
+ color: #56c8ff;
+ }
+ pre a.h {
+ color: #00cdcd;
+ }
+ .A,
+ span.i,
+ pre a.i {
+ color: #00cd00;
+ }
+ .D,
+ span.d,
+ pre a.d {
+ color: #cd0000;
+ }
+ #branches tr:hover td,
+ #tags tr:hover td,
+ #index tr:hover td,
+ #log tr:hover td,
+ #files tr:hover td {
+ background-color: #111;
+ }
+}
diff --git a/make.py b/make.py
@@ -53,6 +53,7 @@ async def main():
PUBLIC_PATH="$(realpath public/{output_url})"
STAGIT_PATH="$(realpath {stagit_path})"
+ STYLE_PATH="$(realpath style.css)"
rm -rf "$GIT_PATH"/hooks
@@ -72,6 +73,7 @@ async def main():
echo + stagit {output_url}
( cd "$PUBLIC_PATH" &&
"$STAGIT_PATH" \
+ -s "$STYLE_PATH" \
-u https://blog.grace.moe/{output_url} \
"$GIT_PATH" &&
echo '<meta http-equiv="refresh" content="0; url=log.html" />' > index.html
@@ -126,7 +128,7 @@ async def main():
),
)
await shell(
- "cd public && ../stagit/stagit-index blog.grace.moe git.grace.moe pymake stagit > index.html",
+ "cd public && ../stagit/stagit-index -s ../index-style.css blog.grace.moe git.grace.moe pymake stagit > index.html",
echo=EchoAll,
)
diff --git a/style.css b/style.css
@@ -0,0 +1,185 @@
+body {
+ color: #000;
+ background-color: #fff;
+ font-family: Arial, Helvetica, sans-serif;
+ -webkit-font-smoothing: antialiased;
+}
+
+#content > pre:first-child {
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+#content > pre:first-child > table > tbody > tr > td:last-child,
+#content > pre:first-child > table > tbody > tr > td:first-child,
+#content > pre:last-child {
+ font-family: 'Courier New', Courier, monospace;
+ font-size: 10pt;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-size: 1em;
+ margin: 0;
+}
+
+img,
+svg,
+h1,
+h2 {
+ vertical-align: middle;
+}
+
+img {
+ border: 0;
+}
+
+a:target {
+ background-color: #ccc;
+}
+
+a.d,
+a.h,
+a.i,
+a.line {
+ text-decoration: none;
+}
+
+#blob a {
+ color: #555;
+}
+
+#blob a:hover {
+ color: blue;
+ text-decoration: none;
+}
+
+table thead td {
+ font-weight: bold;
+}
+
+table td {
+ padding: 0 0.4em;
+}
+
+#content table td {
+ vertical-align: top;
+ white-space: nowrap;
+}
+
+#branches tr:hover td,
+#tags tr:hover td,
+#index tr:hover td,
+#log tr:hover td,
+#files tr:hover td {
+ background-color: #eee;
+}
+
+#index tr td:nth-child(2),
+#tags tr td:nth-child(3),
+#branches tr td:nth-child(3),
+#log tr td:nth-child(2) {
+ white-space: normal;
+}
+
+td.num {
+ text-align: right;
+}
+
+.desc {
+ color: #555;
+}
+
+hr {
+ border: 0;
+ border-top: 1px solid #555;
+ height: 1px;
+}
+
+pre {
+ font-family: monospace;
+}
+
+pre a.h {
+ color: #00a;
+}
+
+.A,
+span.i,
+pre a.i {
+ color: #070;
+}
+
+.D,
+span.d,
+pre a.d {
+ color: #e00;
+}
+
+pre a.h:hover,
+pre a.i:hover,
+pre a.d:hover {
+ text-decoration: none;
+}
+
+@media (prefers-color-scheme: dark) {
+ body {
+ background-color: #000;
+ color: #bdbdbd;
+ }
+
+ hr {
+ border-color: #222;
+ }
+
+ a {
+ color: #56c8ff;
+ }
+
+ a:target {
+ background-color: #222;
+ }
+
+ .desc {
+ color: #aaa;
+ }
+
+ #blob a {
+ color: #555;
+ }
+
+ #blob a:target {
+ color: #eee;
+ }
+
+ #blob a:hover {
+ color: #56c8ff;
+ }
+
+ pre a.h {
+ color: #00cdcd;
+ }
+
+ .A,
+ span.i,
+ pre a.i {
+ color: #00cd00;
+ }
+
+ .D,
+ span.d,
+ pre a.d {
+ color: #cd0000;
+ }
+
+ #branches tr:hover td,
+ #tags tr:hover td,
+ #index tr:hover td,
+ #log tr:hover td,
+ #files tr:hover td {
+ background-color: #111;
+ }
+}