diff --git a/client/index.html b/client/index.html
index 74940d40..1276b99b 100644
--- a/client/index.html
+++ b/client/index.html
@@ -15,7 +15,7 @@
- ">
+
@@ -241,6 +241,19 @@
Enable colored nicknames
+
+
Theme
+
+
+
+
+
<% if (typeof prefetch === "undefined" || prefetch !== false) { %>
Links and URLs
diff --git a/client/js/lounge.js b/client/js/lounge.js
index 2b8b0ee6..a5105f1b 100644
--- a/client/js/lounge.js
+++ b/client/js/lounge.js
@@ -473,6 +473,7 @@ $(function() {
notifyAllMessages: false,
part: true,
quit: true,
+ theme: $("#theme").attr("href").replace(/^themes\/(.*).css$/, "$1"), // Extracts default theme name, set on the server configuration
thumbnails: true,
userStyles: userStyles.text(),
}, JSON.parse(window.localStorage.getItem("settings")));
@@ -485,6 +486,9 @@ $(function() {
settings.find("#user-specified-css-input").val(options[i]);
} else if (i === "highlights") {
settings.find("input[name=" + i + "]").val(options[i]);
+ } else if (i === "theme") {
+ $("#theme").attr("href", "themes/" + options[i] + ".css");
+ settings.find("select[name=" + i + "]").val(options[i]);
} else if (options[i]) {
settings.find("input[name=" + i + "]").prop("checked", true);
}
@@ -516,6 +520,8 @@ $(function() {
chat.toggleClass("hide-" + name, !self.prop("checked"));
} else if (name === "coloredNicks") {
chat.toggleClass("colored-nicks", self.prop("checked"));
+ } else if (name === "theme") {
+ $("#theme").attr("href", "themes/" + options[name] + ".css");
} else if (name === "userStyles") {
$(document.head).find("#user-specified-css").html(options[name]);
} else if (name === "highlights") {
diff --git a/src/server.js b/src/server.js
index 872e4308..4dcade40 100644
--- a/src/server.js
+++ b/src/server.js
@@ -122,6 +122,11 @@ function index(req, res, next) {
Helper.config
);
data.gitCommit = gitCommit;
+ data.themes = fs.readdirSync("client/themes/").filter(function(file) {
+ return file.endsWith(".css");
+ }).map(function(css) {
+ return css.slice(0, -4);
+ });
var template = _.template(file);
res.setHeader("Content-Security-Policy", "default-src *; style-src * 'unsafe-inline'; script-src 'self'; child-src 'none'; object-src 'none'; form-action 'none'; referrer no-referrer;");
res.setHeader("Content-Type", "text/html");