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

19 lines
509 B
JavaScript
Raw Normal View History

2021-11-18 14:41:22 +05:00
const JSONStorage = require("../jsonstorage");
2021-09-29 14:02:47 +05:00
const { nativeTheme } = require("electron");
function getTheme() {
2021-11-18 14:41:22 +05:00
return JSONStorage.get("theme") || "light";
}
function setTheme(theme) {
2021-09-29 14:02:47 +05:00
nativeTheme.themeSource = theme;
if (global.win) global.win.setBackgroundColor(getBackgroundColor(theme));
2021-11-18 14:41:22 +05:00
return JSONStorage.set("theme", theme);
}
function getBackgroundColor() {
return nativeTheme.shouldUseDarkColors ? "#0f0f0f" : "#ffffff";
}
module.exports = { getTheme, setTheme, getBackgroundColor };