diff --git a/index.html b/index.html
index 2984351..03aa1f2 100644
--- a/index.html
+++ b/index.html
@@ -14,6 +14,7 @@
+
@@ -38,7 +39,6 @@
-
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 05b27a4..5e8817c 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -418,6 +418,27 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}
});
+
+ // Inject theme CSS
+ settings.addCallback('theme', function(theme) {
+ // Unload old theme
+ var oldThemeCSS = document.getElementById("themeCSS");
+ if (oldThemeCSS) {
+ oldThemeCSS.parentNode.removeChild(oldThemeCSS);
+ }
+
+ // Load new theme
+ (function() {
+ var elem = document.createElement("link");
+ elem.rel = "stylesheet";
+ elem.href = "css/themes/" + theme + ".css";
+ elem.media = "screen";
+ elem.id = "themeCSS";
+ document.getElementsByTagName("head")[0].appendChild(elem);
+ })();
+ });
+
+
// Update font family when changed
settings.addCallback('fontfamily', function(fontfamily) {
utils.changeClassStyle('favorite-font', 'fontFamily', fontfamily);