Skip to content

Commit 9c963c8

Browse files
committed
Fix auto default in light-dark-auto mode
1 parent 558b643 commit 9c963c8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/layouts/Layout.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ if (themeMode === 'light-dark-auto' && siteConfig.themes.include.length < 2) {
5151
}
5252
let defaultTheme = siteConfig.themes.default || siteConfig.themes.include[0]
5353
let includedThemes = siteConfig.themes.include as string[]
54-
if (!includedThemes.includes(defaultTheme)) {
54+
const themeNotIncluded = includedThemes.includes(defaultTheme)
55+
if (
56+
(themeMode !== 'light-dark-auto' && themeNotIncluded) ||
57+
(themeMode === 'light-dark-auto' && defaultTheme !== 'auto' && themeNotIncluded)
58+
) {
5559
console.warn(
5660
`Default theme "${defaultTheme}" not found in themes. Using first theme: "${siteConfig.themes.include[0]}".`,
5761
)

0 commit comments

Comments
 (0)