Skip to content

Commit

Permalink
Added Black Theme feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosinani committed Aug 21, 2017
1 parent 73b51da commit 10b6d92
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ ipc.on('toggle-dark-mode', () => {
darkMode();
});

function blackMode() {
document.documentElement.classList.toggle('black-mode', config.get('blackMode'));
}

ipc.on('toggle-black-mode', () => {
config.set('blackMode', !config.get('blackMode'));
blackMode();
});

ipc.on('toggle-notebooks', () => {
// Toggle notebooks list
document.querySelector('#gwt-debug-Sidebar-notebooksButton').click();
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = new Config({
height: 500
},
darkMode: false,
blackMode: false,
alwaysOnTop: false,
lastURL: 'https://www.evernote.com/Login.action'
}
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function createMainWindow() {
const lastURL = config.get('lastURL');
const maxWindowInteger = 2147483647;
const darkModeFlag = config.get('darkMode');
const blackModeFlag = config.get('blackMode');

const win = new electron.BrowserWindow({
title: app.getName(),
Expand Down Expand Up @@ -102,6 +103,7 @@ app.on('ready', () => {
page.on('dom-ready', () => {
page.insertCSS(fs.readFileSync(path.join(__dirname, 'browser.css'), 'utf8'));
page.insertCSS(fs.readFileSync(path.join(__dirname, 'dark-mode.css'), 'utf8'));
page.insertCSS(fs.readFileSync(path.join(__dirname, 'black-mode.css'), 'utf8'));
mainWindow.show();
});

Expand Down
12 changes: 12 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ const darwinTpl = [{
click() {
sendAction('toggle-dark-mode');
}
}, {
label: 'Toggle Black Mode',
accelerator: 'CmdOrCtrl+Alt+D',
click() {
sendAction('toggle-black-mode');
}
}, {
type: 'separator'
}, {
Expand Down Expand Up @@ -493,6 +499,12 @@ const otherTpl = [{
click() {
sendAction('toggle-dark-mode');
}
}, {
label: 'Toggle Black Mode',
accelerator: 'CmdOrCtrl+Alt+D',
click() {
sendAction('toggle-black-mode');
}
}, {
type: 'separator'
}, {
Expand Down

0 comments on commit 10b6d92

Please sign in to comment.