+$(function() {
+ var theme_ul = '<ul class="list-inline" id="themes">' +
+ '<li><a role="button" data-theme="cyborg">Black</a>' +
+ '<li><a role="button" data-theme="slate">Grey</a>' +
+ '<li><a role="button" data-theme="readable">White</a></ul>';
+ var sidebar = $('#sidebar')[0];
+ sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
+ $('#themes a').on('click', e => set_style(e.target.dataset.theme, true));
+});
+
+let theme = localStorage.getItem("theme");
+if(theme) {
+ if(theme == "cerulean" || theme == "cosmo")
+ theme = "readable";
+ set_style(theme, false);
+}