Files
notesnook/apps/web/desktop/config/theme.js

20 lines
545 B
JavaScript
Raw Normal View History

const { default: storage } = require("electron-data-storage");
2021-09-29 14:02:47 +05:00
const { nativeTheme } = require("electron");
function getTheme() {
return storage.getSync("theme") || "light";
}
function setTheme(theme) {
2021-09-29 14:02:47 +05:00
nativeTheme.themeSource = theme;
if (global.win) global.win.setBackgroundColor(getBackgroundColor(theme));
return storage.set("theme", theme);
}
2021-09-29 14:02:47 +05:00
function getBackgroundColor(theme) {
if (!theme) theme = getTheme();
return theme === "dark" ? "#0f0f0f" : "#ffffff";
}
module.exports = { getTheme, setTheme, getBackgroundColor };