From 947fd1daba76311968e10ac6092f972098d1d751 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Jul 2023 17:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=BB=E9=A2=98=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 2 +- components/PrismMac.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blog.config.js b/blog.config.js index 6b517655..fa9a5845 100644 --- a/blog.config.js +++ b/blog.config.js @@ -95,7 +95,7 @@ const BLOG = { PRISM_JS_PATH: 'https://npm.elemecdn.com/prismjs@1.29.0/components/', // 代码主题 https://github.com/PrismJS/prism-themes PRISM_THEME_PREFIX_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.css', // 代码块默认主题 - PRISM_THEME_SWITCH: true, // 是否开启浅色/深色模式代码主题切换 + PRISM_THEME_SWITCH: process.env.NEXT_PUBLIC_PRISM_THEME_SWITCH || true, // 是否开启浅色/深色模式代码主题切换 PRISM_THEME_LIGHT_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-solarizedlight.css', // 浅色模式主题 PRISM_THEME_DARK_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.min.css', // 深色模式主题 diff --git a/components/PrismMac.js b/components/PrismMac.js index 9eab8fe7..bc3b7a7e 100644 --- a/components/PrismMac.js +++ b/components/PrismMac.js @@ -60,7 +60,7 @@ const loadPrismThemeCSS = () => { let PRISM_THEME let PRISM_PREVIOUS const themeClass = document.documentElement.className - if (BLOG.PRISM_THEME_SWITCH) { + if (JSON.parse(BLOG.PRISM_THEME_SWITCH)) { if (themeClass === 'dark') { PRISM_THEME = BLOG.PRISM_THEME_DARK_PATH PRISM_PREVIOUS = BLOG.PRISM_THEME_LIGHT_PATH