lbry-desktop/ui/js/util/setTheme.js
2017-08-12 13:51:16 -06:00

19 lines
495 B
JavaScript

import lbry from "lbry";
import { existsSync } from "fs";
import { remote } from "electron";
function setTheme(name) {
const link = document.getElementById("theme");
const file = `${name}.css`;
const path = `${remote.app.getAppPath()}/dist/themes/${file}`;
if (existsSync(path)) {
link.href = `./themes/${file}`;
lbry.setClientSetting("theme", name);
} else {
link.href = `./themes/light.css`;
lbry.setClientSetting("theme", "light");
}
}
export default setTheme;