aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/darkmode.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-12-07 22:39:12 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-12-07 22:39:12 +0100
commit65aaac06beac7f070a3a81adeffb8e1887d9f12b (patch)
treee2b4f452eef8c17198845e7a59c49b4fe28b1823 /src/webview/darkmode.js
parentfeat(Service): Add option to change spellchecking language by service (diff)
downloadferdium-app-65aaac06beac7f070a3a81adeffb8e1887d9f12b.tar.gz
ferdium-app-65aaac06beac7f070a3a81adeffb8e1887d9f12b.tar.zst
ferdium-app-65aaac06beac7f070a3a81adeffb8e1887d9f12b.zip
chore(Recipe): Refactor recipe plugin
Diffstat (limited to 'src/webview/darkmode.js')
-rw-r--r--src/webview/darkmode.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/webview/darkmode.js b/src/webview/darkmode.js
index 9830ef33c..73c7007c6 100644
--- a/src/webview/darkmode.js
+++ b/src/webview/darkmode.js
@@ -1,7 +1,13 @@
1/* eslint no-bitwise: ["error", { "int32Hint": true }] */
2
1import path from 'path'; 3import path from 'path';
2import fs from 'fs-extra'; 4import fs from 'fs-extra';
3 5
4const ID = 'franz-theme-dark-mode'; 6const debug = require('debug')('Franz:DarkMode');
7
8const chars = [...'abcdefghijklmnopqrstuvwxyz'];
9
10const ID = [...Array(20)].map(() => chars[Math.random() * chars.length | 0]).join``;
5 11
6export function injectDarkModeStyle(recipePath) { 12export function injectDarkModeStyle(recipePath) {
7 const darkModeStyle = path.join(recipePath, 'darkmode.css'); 13 const darkModeStyle = path.join(recipePath, 'darkmode.css');
@@ -12,6 +18,8 @@ export function injectDarkModeStyle(recipePath) {
12 styles.innerHTML = data.toString(); 18 styles.innerHTML = data.toString();
13 19
14 document.querySelector('head').appendChild(styles); 20 document.querySelector('head').appendChild(styles);
21
22 debug('Injected Dark Mode style with ID', ID);
15 } 23 }
16} 24}
17 25
@@ -20,6 +28,8 @@ export function removeDarkModeStyle() {
20 28
21 if (style) { 29 if (style) {
22 style.remove(); 30 style.remove();
31
32 debug('Removed Dark Mode Style with ID', ID);
23 } 33 }
24} 34}
25 35