mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-19 19:19:03 +00:00
Use Notion's localstorage native theme setting for night shift instead of overriding classes.
This commit is contained in:
parent
f304f78177
commit
b846677580
@ -29,13 +29,11 @@ module.exports = {
|
|||||||
attributes: true,
|
attributes: true,
|
||||||
});
|
});
|
||||||
function process(list, observer) {
|
function process(list, observer) {
|
||||||
const mode = `notion-app-inner notion-${
|
const mode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').matches
|
if (!window.localStorage.getItem('theme').includes(mode)) {
|
||||||
? 'dark'
|
window.localStorage.setItem('theme', `{"mode":"${mode}"}`)
|
||||||
: 'light'
|
location.reload()
|
||||||
}-theme`;
|
}
|
||||||
if (list[0].target.className !== mode)
|
|
||||||
list[0].target.className = mode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user