File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,7 @@ impl HtmlHandlebars {
340
340
) ;
341
341
handlebars. register_helper ( "previous" , Box :: new ( helpers:: navigation:: previous) ) ;
342
342
handlebars. register_helper ( "next" , Box :: new ( helpers:: navigation:: next) ) ;
343
+ // TODO: remove theme_option in 0.5, it is not needed.
343
344
handlebars. register_helper ( "theme_option" , Box :: new ( helpers:: theme:: theme_option) ) ;
344
345
}
345
346
@@ -630,6 +631,7 @@ fn make_data(
630
631
) ;
631
632
}
632
633
634
+ // TODO: remove default_theme in 0.5, it is not needed.
633
635
let default_theme = match html_config. default_theme {
634
636
Some ( ref theme) => theme. to_lowercase ( ) ,
635
637
None => "light" . to_string ( ) ,
Original file line number Diff line number Diff line change @@ -300,6 +300,13 @@ function playground_text(playground) {
300
300
themePopup . querySelector ( "button#" + get_theme ( ) ) . focus ( ) ;
301
301
}
302
302
303
+ function updateThemeSelected ( ) {
304
+ themePopup . querySelectorAll ( '.theme-selected' ) . forEach ( function ( el ) {
305
+ el . classList . remove ( 'theme-selected' ) ;
306
+ } ) ;
307
+ themePopup . querySelector ( "button#" + get_theme ( ) ) . classList . add ( 'theme-selected' ) ;
308
+ }
309
+
303
310
function hideThemes ( ) {
304
311
themePopup . style . display = 'none' ;
305
312
themeToggleButton . setAttribute ( 'aria-expanded' , false ) ;
@@ -355,6 +362,7 @@ function playground_text(playground) {
355
362
356
363
html . classList . remove ( previousTheme ) ;
357
364
html . classList . add ( theme ) ;
365
+ updateThemeSelected ( ) ;
358
366
}
359
367
360
368
// Set theme
Original file line number Diff line number Diff line change @@ -517,7 +517,7 @@ ul#searchresults span.teaser em {
517
517
width : 100% ;
518
518
border : 0 ;
519
519
margin : 0 ;
520
- padding : 2px 10 px ;
520
+ padding : 2px 20 px ;
521
521
line-height : 25px ;
522
522
white-space : nowrap;
523
523
text-align : left;
@@ -529,3 +529,10 @@ ul#searchresults span.teaser em {
529
529
.theme-popup .theme : hover {
530
530
background-color : var (--theme-hover );
531
531
}
532
+
533
+ .theme-selected ::before {
534
+ display : inline-block;
535
+ content : "✓" ;
536
+ margin-left : -14px ;
537
+ width : 14px ;
538
+ }
Original file line number Diff line number Diff line change 121
121
<i class =" fa fa-paint-brush" ></i >
122
122
</button >
123
123
<ul id =" theme-list" class =" theme-popup" aria-label =" Themes" role =" menu" >
124
- <li role =" none" ><button role =" menuitem" class =" theme" id =" light" >{{ theme_option " Light" }} </button ></li >
125
- <li role =" none" ><button role =" menuitem" class =" theme" id =" rust" >{{ theme_option " Rust" }} </button ></li >
126
- <li role =" none" ><button role =" menuitem" class =" theme" id =" coal" >{{ theme_option " Coal" }} </button ></li >
127
- <li role =" none" ><button role =" menuitem" class =" theme" id =" navy" >{{ theme_option " Navy" }} </button ></li >
128
- <li role =" none" ><button role =" menuitem" class =" theme" id =" ayu" >{{ theme_option " Ayu" }} </button ></li >
124
+ <li role =" none" ><button role =" menuitem" class =" theme" id =" light" >Light</button ></li >
125
+ <li role =" none" ><button role =" menuitem" class =" theme" id =" rust" >Rust</button ></li >
126
+ <li role =" none" ><button role =" menuitem" class =" theme" id =" coal" >Coal</button ></li >
127
+ <li role =" none" ><button role =" menuitem" class =" theme" id =" navy" >Navy</button ></li >
128
+ <li role =" none" ><button role =" menuitem" class =" theme" id =" ayu" >Ayu</button ></li >
129
129
</ul >
130
130
{{ #if search_enabled }}
131
131
<button id =" search-toggle" class =" icon-button" type =" button" title =" Search. (Shortkey: s)" aria-label =" Toggle Searchbar" aria-expanded =" false" aria-keyshortcuts =" S" aria-controls =" searchbar" >
You can’t perform that action at this time.
0 commit comments