feat: 暗黑主题

This commit is contained in:
2026-07-13 00:04:11 +08:00
parent 0b9c253402
commit 36b04537b4
8 changed files with 1424 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
---
import "github-markdown-css/github-markdown-light.css"
import "@/styles/github-markdown.css"
import "@/styles/github-markdown-reset.css"
import Layout from "@/layouts/Layout.astro";
import {createHttp} from "@/lib/request.ts";
@@ -57,7 +57,11 @@ const published_at = formatDatetime(data.published_at, 'YYYY 年 M 月 D 日')
</div>
</div>
<div class="post markdown-body" set:html={content}></div>
<div
class="post markdown-body"
data-color-mode="dark"
set:html={content}
></div>
</Layout>
<style>
@@ -106,7 +110,7 @@ const published_at = formatDatetime(data.published_at, 'YYYY 年 M 月 D 日')
.post-view svg {
width: 20px;
height: 20px;
fill: currentColor; /* 让填充跟随 color */
fill: currentColor; /* 让填充跟随 color */
stroke: currentColor; /* 让描边也跟随 color */
}
@@ -119,4 +123,9 @@ const published_at = formatDatetime(data.published_at, 'YYYY 年 M 月 D 日')
padding: 12px;
}
}
:global(.dark) .post{
background: #090b0c;
box-shadow: rgba(255, 255, 255, 0.5) 0 0px 10px -4px;
}
</style>