aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-12 17:06:03 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-12 19:00:24 -0400
commitc90bc75eb89f5a731f6e3366f6388b594a27b2aa (patch)
tree2f4bab44530d23e8c17d7e1d68bb676005a521da /ext/mixed/js
parentceaeeb32dd23403c516f5aa5cb5527c40f2f21aa (diff)
Create themes
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index cd9f41bd..2bf917aa 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -194,6 +194,17 @@ class Display {
async updateOptions(options) {
this.options = options ? options : await apiOptionsGet(this.getOptionsContext());
+ this.updateTheme(this.options.general.popupTheme);
+ }
+
+ updateTheme(themeName) {
+ document.documentElement.dataset.yomichanTheme = themeName;
+
+ const stylesheets = document.querySelectorAll('link[data-yomichan-theme-name]');
+ for (const stylesheet of stylesheets) {
+ const match = (stylesheet.dataset.yomichanThemeName === themeName);
+ stylesheet.rel = (match ? 'stylesheet' : 'stylesheet alternate');
+ }
}
setInteractive(interactive) {