class Theme {
    static clear() {
        // Clear all themes from localStorage
        if (delete localStorage['themes'] === true) {
            console.debug("Deleted themes successfully");
        } else {
            console.error("Couldn't delete themes");
        }
    }
    constructor(saveObject) {
        // bg is background color, sc is secondary color
        if (saveObject) {
            this.bg = saveObject.bg;
            this.sc = saveObject.sc;
        } else {
            this.bg = null;
            this.sc = null;
        }
    }
    save() {
        if (localStorage[Theme.STORAGE_KEY] !== 'undefined') {
            // There are no themess in localStorage, it is safe to write to
            var saveObject = this.getSaveObject();
            localStorage[Theme.STORAGE_KEY] = JSON.stringify([saveObject]);
        } else {
            var oldThemes = null;
            try {
                oldThemes = JSON.parse(localStorage[Theme.STORAGE_KEY]);
            } catch (e) {
                ukahoot.interface.showAlert('There was an error saving the theme!');
                console.error('There was an error parsing localStorage JSON:', e);
            }
            if (oldThemes) {
                // TODO: append this theme to localStorage
            }
        }
    }
    getSaveObject() {
        return {
            'bg': this.bg,
            'sc': this.sc
        }
    }
    apply() {
        if (this.bg) {
            document.documentElement.style.backgroundColor = this.bg;
            document.body.style.backgroundColor = this.bg;
        } else console.warn('Not applying nonexistent theme background color');
    }
}
Theme.STORAGE_KEY = 'themes';
class ThemeEditor {
    constructor(elem) {
        if (!elem) throw new Error("ThemeEditor needs a container element!");
        this.elm = elem;
    }
}
@@ -658,17 +658,16 @@
 o themes
-s
  in loca
@@ -699,16 +699,16 @@
 rite to%0A
+
         
@@ -1412,24 +1412,47 @@
   apply() %7B%0A
+        var me = this;%0A
         if (
@@ -1583,32 +1583,32 @@
 olor = this.bg;%0A
-
         %7D else c
@@ -1667,24 +1667,1272 @@
 nd color');%0A
+        if (this.sc) %7B%0A            var elms = Array.prototype.slice.call(document.getElementsByTagName('h1'));%0A            elms.push.apply(elms,%0A                                        document.getElementsByTagName('h2'));%0A            elms.push.apply(elms,%0A                                        document.getElementsByClassName('shape'));%0A            elms.push(document.getElementById('wait'));%0A            elms.forEach(e =%3E %7B%0A                if (e) %7B%0A                    e.style.color = me.sc;%0A                %7D else console.warn('Not applying theme CSS to null element');%0A            %7D);%0A            elms = Array.prototype.slice.call(document.getElementsByTagName('input'));%0A            elms.push.apply(elms,%0A                                        document.getElementsByTagName('button'));%0A            elms.push.apply(elms,%0A                                        document.getElementsByClassName('ans'));%0A           elms.push(document.getElementById('alert-box'));%0A           elms.forEach(e =%3E %7B%0A                if (e) %7B%0A                    e.style.borderColor = me.sc;%0A                %7D else console.warn('Not applying theme CSS to null element');%0A            %7D);%0A        %7D else console.warn('Not applying nonexistent theme secondary color');%0A
     %7D%0A%7D%0AThem

Add theme apply method