mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-20 03:29:02 +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,
|
||||
});
|
||||
function process(list, observer) {
|
||||
const mode = `notion-app-inner notion-${
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'dark'
|
||||
: 'light'
|
||||
}-theme`;
|
||||
if (list[0].target.className !== mode)
|
||||
list[0].target.className = mode;
|
||||
const mode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||
if (!window.localStorage.getItem('theme').includes(mode)) {
|
||||
window.localStorage.setItem('theme', `{"mode":"${mode}"}`)
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user