notion-enhancer/src/core/theming/frame.mjs
dragonwocky d304f698a8
refactor: simplifications
- remove registry validation
- separate core from mods
- use __enhancerApi global for consistent api access
- use key-based namespacing instead of nested objects
2022-12-14 23:15:32 +11:00

20 lines
586 B
JavaScript

/**
* notion-enhancer: theming
* (c) 2021 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
* (https://notion-enhancer.github.io/) under the MIT license
*/
'use strict';
export default async function ({ web, storage, electron }, db) {
await web.whenReady();
const updateTheme = async () => {
const mode = await storage.get(['theme'], 'light');
document.documentElement.classList.add(mode);
document.documentElement.classList.remove(mode === 'light' ? 'dark' : 'light');
};
electron.onMessage('update-theme', updateTheme);
updateTheme();
}