From d6c4d1a4d799b57cb9392ae3627bad606d9b0c24 Mon Sep 17 00:00:00 2001 From: GZTime Date: Sun, 27 Oct 2024 03:19:09 +0800 Subject: [PATCH] fix(theme): default to dark mode --- rspress.config.ts | 19 +++++++++++++++++++ theme/components/LogoHeader.tsx | 6 +++--- theme/components/icon/MainIcon.tsx | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/rspress.config.ts b/rspress.config.ts index 2372199..541b28b 100644 --- a/rspress.config.ts +++ b/rspress.config.ts @@ -16,6 +16,20 @@ export default defineConfig({ ], markdown: { checkDeadLinks: true, + showLineNumbers: true, + highlightLanguages: [ + ['js', 'javascript'], + ['ts', 'typescript'], + ['jsx', 'tsx'], + ['xml', 'xml-doc'], + ['md', 'markdown'], + ['mdx', 'tsx'], + ['yml', 'yaml'], + ['py', 'python'], + ['sh', 'bash'], + ['json', 'json'], + ['txt', 'plaintext'] + ] }, ssg: { strict: true, @@ -50,6 +64,8 @@ export default defineConfig({ content: "https://discord.gg/dV9A6ZjVhC", }, ], + lastUpdated: true, + enableScrollToTop: true, enableContentAnimation: true, enableAppearanceAnimation: false, footer: { @@ -63,6 +79,7 @@ export default defineConfig({ outlineTitle: "目录", prevPageText: "上一页", nextPageText: "下一页", + lastUpdatedText: "最后更新于", searchPlaceholderText: "搜索文档", searchNoResultsText: "没有找到有关内容", searchSuggestedQueryText: "建议更换不同的关键字后重试", @@ -73,6 +90,7 @@ export default defineConfig({ outlineTitle: "Table of Contents", prevPageText: "Previous", nextPageText: "Next", + lastUpdatedText: "Last Updated", searchPlaceholderText: "Search Docs", searchNoResultsText: "No results for", searchSuggestedQueryText: "Please try again with a different keyword", @@ -83,6 +101,7 @@ export default defineConfig({ outlineTitle: "目次", prevPageText: "前へ", nextPageText: "次へ", + lastUpdatedText: "最終更新", searchPlaceholderText: "ドキュメントを検索", searchNoResultsText: "関連する結果がありません", } diff --git a/theme/components/LogoHeader.tsx b/theme/components/LogoHeader.tsx index d48325f..1d9c3b7 100644 --- a/theme/components/LogoHeader.tsx +++ b/theme/components/LogoHeader.tsx @@ -8,9 +8,9 @@ export const LogoHeader: FC = () => { const pageData = usePageData(); const defaultLang = pageData.siteData.lang ?? ""; const lang = pageData.page.lang; - const darkMode = theme === "dark"; - const color = darkMode ? "#fff" : "#414141"; - const highlightColor = darkMode ? "#0AD7AF" : "#02BFA5"; + const lightMode = theme === "light"; + const color = lightMode ? "#414141" : "#fff"; + const highlightColor = lightMode ? "#02BFA5" : "#0AD7AF"; return (
diff --git a/theme/components/icon/MainIcon.tsx b/theme/components/icon/MainIcon.tsx index c053a6b..d4f3533 100644 --- a/theme/components/icon/MainIcon.tsx +++ b/theme/components/icon/MainIcon.tsx @@ -9,7 +9,7 @@ const MainIcon: FC = (props: MainIconProps) => { const { ignoreTheme, ...svgProps } = props; const { theme } = useContext(ThemeContext); - const color = theme === "dark" ? "#fff" : "#414141"; + const color = theme === "light" ? "#414141" : "#fff"; return (