diff --git a/src/theme/book.js b/src/theme/book.js
index c14c5cb2..bb441de9 100644
--- a/src/theme/book.js
+++ b/src/theme/book.js
@@ -3,6 +3,12 @@ $( document ).ready(function() {
// url
var url = window.location.pathname;
+ // Set theme
+ var theme = localStorage.getItem('theme');
+ if (theme == null) { theme = 'light'; }
+
+ set_theme(theme);
+
// Syntax highlighting Configuration
hljs.configure({
tabReplace: ' ', // 4 spaces
@@ -44,17 +50,32 @@ $( document ).ready(function() {
} else {
var popup = $('
')
.append($('Light (default)
'))
- .append($('
Dark
'));
+ .append($('
Coal
'))
+ .append($('
Navy
'));
$(this).append(popup);
$('.theme').click(function(){
var theme = $(this).attr('id');
- $('body').removeClass().addClass(theme);
+
+ set_theme(theme)
});
}
});
+ function set_theme(theme) {
+ if (theme == 'coal' || theme == 'navy') {
+ $("[href='tomorrow-night.css']").prop('disabled', false);
+ $("[href='highlight.css']").prop('disabled', true);
+ } else {
+ $("[href='tomorrow-night.css']").prop('disabled', true);
+ $("[href='highlight.css']").prop('disabled', false);
+ }
+
+ localStorage.setItem('theme', theme);
+
+ $('body').removeClass().addClass(theme);
+ }
});