diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 710449af..1b648dac 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -340,6 +340,7 @@ impl HtmlHandlebars { ); handlebars.register_helper("previous", Box::new(helpers::navigation::previous)); handlebars.register_helper("next", Box::new(helpers::navigation::next)); + // TODO: remove theme_option in 0.5, it is not needed. handlebars.register_helper("theme_option", Box::new(helpers::theme::theme_option)); } @@ -630,6 +631,7 @@ fn make_data( ); } + // TODO: remove default_theme in 0.5, it is not needed. let default_theme = match html_config.default_theme { Some(ref theme) => theme.to_lowercase(), None => "light".to_string(), diff --git a/src/theme/book.js b/src/theme/book.js index c8f52cc1..627a368e 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -300,6 +300,13 @@ function playground_text(playground) { themePopup.querySelector("button#" + get_theme()).focus(); } + function updateThemeSelected() { + themePopup.querySelectorAll('.theme-selected').forEach(function (el) { + el.classList.remove('theme-selected'); + }); + themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected'); + } + function hideThemes() { themePopup.style.display = 'none'; themeToggleButton.setAttribute('aria-expanded', false); @@ -355,6 +362,7 @@ function playground_text(playground) { html.classList.remove(previousTheme); html.classList.add(theme); + updateThemeSelected(); } // Set theme diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index ff3158ad..59eae11f 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -517,7 +517,7 @@ ul#searchresults span.teaser em { width: 100%; border: 0; margin: 0; - padding: 2px 10px; + padding: 2px 20px; line-height: 25px; white-space: nowrap; text-align: left; @@ -529,3 +529,10 @@ ul#searchresults span.teaser em { .theme-popup .theme:hover { background-color: var(--theme-hover); } + +.theme-selected::before { + display: inline-block; + content: "✓"; + margin-left: -14px; + width: 14px; +} diff --git a/src/theme/index.hbs b/src/theme/index.hbs index d8955de4..147eb9af 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -121,11 +121,11 @@