From 032abf1b19d2a3b7be9f2188ba4d5da9d1fc8913 Mon Sep 17 00:00:00 2001 From: Kia Ishii Date: Mon, 30 May 2022 16:02:26 +0900 Subject: [PATCH] refactor: change back default theme to palenight --- src/client/theme-default/index.ts | 2 +- .../components/{code.css => vp-code.css} | 0 .../styles/components/vp-doc.css | 2 +- src/client/theme-default/styles/vars.css | 22 +++++++++---------- src/node/markdown/plugins/highlight.ts | 22 +++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) rename src/client/theme-default/styles/components/{code.css => vp-code.css} (100%) diff --git a/src/client/theme-default/index.ts b/src/client/theme-default/index.ts index 563b56d3..ba3dc291 100644 --- a/src/client/theme-default/index.ts +++ b/src/client/theme-default/index.ts @@ -2,8 +2,8 @@ import './styles/fonts.css' import './styles/vars.css' import './styles/base.css' import './styles/utils.css' -import './styles/components/code.css' import './styles/components/custom-block.css' +import './styles/components/vp-code.css' import './styles/components/vp-doc.css' import './styles/components/vp-sponsor.css' diff --git a/src/client/theme-default/styles/components/code.css b/src/client/theme-default/styles/components/vp-code.css similarity index 100% rename from src/client/theme-default/styles/components/code.css rename to src/client/theme-default/styles/components/vp-code.css diff --git a/src/client/theme-default/styles/components/vp-doc.css b/src/client/theme-default/styles/components/vp-doc.css index f1cecf96..212141aa 100644 --- a/src/client/theme-default/styles/components/vp-doc.css +++ b/src/client/theme-default/styles/components/vp-doc.css @@ -410,7 +410,7 @@ text-align: center; font-size: 12px; font-weight: 500; - color: var(--vp-c-text-code); + color: var(--vp-code-copy-code-active-text); background-color: var(--vp-code-copy-code-hover-bg); white-space: nowrap; content: "Copied"; diff --git a/src/client/theme-default/styles/vars.css b/src/client/theme-default/styles/vars.css index c9413e4e..b85d13b4 100644 --- a/src/client/theme-default/styles/vars.css +++ b/src/client/theme-default/styles/vars.css @@ -176,20 +176,20 @@ } /** - * Layouts + * Icons * -------------------------------------------------------------------------- */ -:root { - --vp-layout-max-width: 1440px; + :root { + --vp-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2'/%3E%3C/svg%3E"); + --vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-6 9 2 2 4-4'/%3E%3C/svg%3E"); } /** - * Icons + * Layouts * -------------------------------------------------------------------------- */ :root { - --vp-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2'/%3E%3C/svg%3E"); - --vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-6 9 2 2 4-4'/%3E%3C/svg%3E"); + --vp-layout-max-width: 1440px; } /** @@ -201,17 +201,17 @@ --vp-code-font-size: 0.875em; --vp-code-block-color: var(--vp-c-text-dark-1); - --vp-code-block-bg: var(--vp-c-bg-alt); + --vp-code-block-bg: #292d3e; - --vp-code-line-highlight-color: rgba(225, 225, 225, 0.5); + --vp-code-line-highlight-color: rgba(0, 0, 0, 0.5); --vp-code-line-number-color: var(--vp-c-text-dark-3); - --vp-code-copy-code-hover-bg: rgba(125, 125, 125, 0.1); + --vp-code-copy-code-hover-bg: rgba(255, 255, 255, 0.05); + --vp-code-copy-code-active-text: var(--vp-c-text-dark-2); } .dark { - --vp-code-line-highlight-color: rgba(0, 0, 0, 0.5); - --vp-code-line-number-color: var(--vp-c-text-dark-3); + --vp-code-block-bg: var(--vp-c-bg-alt); } /** diff --git a/src/node/markdown/plugins/highlight.ts b/src/node/markdown/plugins/highlight.ts index a70b4fdb..eb27b559 100644 --- a/src/node/markdown/plugins/highlight.ts +++ b/src/node/markdown/plugins/highlight.ts @@ -1,9 +1,7 @@ import { getHighlighter } from 'shiki' import type { ThemeOptions } from '../markdown' -export async function highlight( - theme: ThemeOptions = { light: 'vitesse-light', dark: 'vitesse-dark' } -) { +export async function highlight(theme: ThemeOptions = 'material-palenight') { const themes = typeof theme === 'string' ? [theme] : [theme.dark, theme.light] const highlighter = await getHighlighter({ themes }) const preRE = /^/ @@ -15,14 +13,16 @@ export async function highlight( return highlighter .codeToHtml(str, { lang, theme }) .replace(preRE, '
')
-    } else {
-      const dark = highlighter
-        .codeToHtml(str, { lang, theme: theme.dark })
-        .replace(preRE, '
')
-      const light = highlighter
-        .codeToHtml(str, { lang, theme: theme.light })
-        .replace(preRE, '
')
-      return dark + light
     }
+
+    const dark = highlighter
+      .codeToHtml(str, { lang, theme: theme.dark })
+      .replace(preRE, '
')
+
+    const light = highlighter
+      .codeToHtml(str, { lang, theme: theme.light })
+      .replace(preRE, '
')
+
+    return dark + light
   }
 }