mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-08 15:06:08 +02:00
System theme support on Safari
This commit is contained in:
parent
41ccd7651c
commit
3b7f5d9b51
@ -142,11 +142,17 @@ export function loadTheme(): Theme {
|
||||
|
||||
export function initThemes(): void {
|
||||
const darkThemeMq = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
darkThemeMq.addEventListener('change', () => {
|
||||
const changeHandler = () => {
|
||||
const themeStr = localStorage.getItem('theme')
|
||||
if (!themeStr) {
|
||||
setTheme(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (darkThemeMq.addEventListener) {
|
||||
darkThemeMq.addEventListener('change', changeHandler)
|
||||
} else if (darkThemeMq.addListener) {
|
||||
// Safari and Mac app support
|
||||
darkThemeMq.addListener(changeHandler)
|
||||
}
|
||||
loadTheme()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user