mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-22 23:16:48 +00:00
feat: new config APPEARANCE_DARK_TIME
Add an option APPEARANCE_DARK_TIME to determine the time period during which dark mode will be automatically activated.
This commit is contained in:
@@ -51,7 +51,7 @@ export function isPreferDark() {
|
||||
// 系统深色模式或时间是夜间时,强行置为夜间模式
|
||||
const date = new Date()
|
||||
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
return prefersDarkMode || (date.getHours() >= 18 || date.getHours() < 6)
|
||||
return prefersDarkMode || (BLOG.APPEARANCE_DARK_TIME && (date.getHours() >= BLOG.APPEARANCE_DARK_TIME[0] || date.getHours() < BLOG.APPEARANCE_DARK_TIME[1]))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user