diff --git a/src/config.ts b/src/config.ts index 8885414..e21f1ad 100644 --- a/src/config.ts +++ b/src/config.ts @@ -24,7 +24,7 @@ export const themeConfig: ThemeConfig = { // COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START color: { // default theme mode - mode: 'light', // light, dark + mode: 'light', // light, dark, auto light: { // primary color // used for title, hover, etc diff --git a/src/content/posts/guides/Theme Guide-en.md b/src/content/posts/guides/Theme Guide-en.md index 3c95c0d..dadbfef 100644 --- a/src/content/posts/guides/Theme Guide-en.md +++ b/src/content/posts/guides/Theme Guide-en.md @@ -41,7 +41,7 @@ site: { ```ts color: { // default theme mode - mode: 'light' // light, dark + mode: 'light' // light, dark, auto // light mode light: { // primary color diff --git a/src/content/posts/guides/Theme Guide-es.md b/src/content/posts/guides/Theme Guide-es.md index 8d0a57d..12fa675 100644 --- a/src/content/posts/guides/Theme Guide-es.md +++ b/src/content/posts/guides/Theme Guide-es.md @@ -41,7 +41,7 @@ site: { ```ts color: { // modo de tema predeterminado - mode: 'light' // light, dark + mode: 'light' // light, dark, auto // modo claro light: { // color primario diff --git a/src/content/posts/guides/Theme Guide-ja.md b/src/content/posts/guides/Theme Guide-ja.md index 5762361..2b818e8 100644 --- a/src/content/posts/guides/Theme Guide-ja.md +++ b/src/content/posts/guides/Theme Guide-ja.md @@ -41,7 +41,7 @@ site: { ```ts color: { // デフォルトテーマモード - mode: 'light' // light, dark + mode: 'light' // light, dark, auto // ライトモード light: { // プライマリカラー diff --git a/src/content/posts/guides/Theme Guide-ru.md b/src/content/posts/guides/Theme Guide-ru.md index e45cb7d..a2a8f0c 100644 --- a/src/content/posts/guides/Theme Guide-ru.md +++ b/src/content/posts/guides/Theme Guide-ru.md @@ -41,7 +41,7 @@ site: { ```ts color: { // режим темы по умолчанию - mode: 'light' // light, dark + mode: 'light' // light, dark, auto // светлый режим light: { // основной цвет diff --git a/src/content/posts/guides/Theme Guide-zh-tw.md b/src/content/posts/guides/Theme Guide-zh-tw.md index 3c1fba1..63487c3 100644 --- a/src/content/posts/guides/Theme Guide-zh-tw.md +++ b/src/content/posts/guides/Theme Guide-zh-tw.md @@ -41,7 +41,7 @@ site: { ```ts color: { // 默認主題 - mode: 'light' // light, dark + mode: 'light' // light, dark, auto // 亮色模式 light: { // 高亮顏色 diff --git a/src/content/posts/guides/Theme Guide-zh.md b/src/content/posts/guides/Theme Guide-zh.md index 463b970..ca74da9 100644 --- a/src/content/posts/guides/Theme Guide-zh.md +++ b/src/content/posts/guides/Theme Guide-zh.md @@ -41,7 +41,7 @@ site: { ```ts color: { // 默认主题 - mode: 'light' // light, dark + mode: 'light' // light, dark, auto // 亮色模式 light: { // 高亮颜色 diff --git a/src/layouts/Head.astro b/src/layouts/Head.astro index 0ec4d44..0c43ec0 100644 --- a/src/layouts/Head.astro +++ b/src/layouts/Head.astro @@ -110,8 +110,10 @@ function isCurrentDark() { const currentTheme = localStorage.getItem('theme') if (currentTheme) return currentTheme === 'dark' - if (defaultMode) - return defaultMode === 'dark' + if (defaultMode === 'light') + return false + if (defaultMode === 'dark') + return true return window.matchMedia('(prefers-color-scheme: dark)').matches } diff --git a/src/types/index.d.ts b/src/types/index.d.ts index a227bd8..c7903d4 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -15,7 +15,7 @@ export interface ThemeConfig { } color: { - mode: 'light' | 'dark' + mode: 'light' | 'dark' | 'auto' light: { primary: string secondary: string