diff --git a/layouts/partials/stylesheet.html b/layouts/partials/stylesheet.html index 28125cc4b8..18bb16d4f9 100644 --- a/layouts/partials/stylesheet.html +++ b/layouts/partials/stylesheet.html @@ -35,7 +35,15 @@ } select.value = theme; } - function changeTheme( theme, noanimation ){ + function changeTheme( theme ){ + {{- $quotedthemevariants := slice }} + {{- range $themevariants }} + {{- $quotedthemevariants = $quotedthemevariants | append (printf "\"%s\"" .) }} + {{- end }} + var themes = [ {{ delimit $quotedthemevariants ", " | safeJS }} ]; + if( !themes.find( function(e){ return e==theme; } ) ){ + theme = themes.length ? themes[ 0 ] : null; + } if( !theme ){ return; }