(theme, store = true)
| 325 | } |
| 326 | |
| 327 | function set_theme(theme, store = true) { |
| 328 | let ace_theme; |
| 329 | |
| 330 | if (theme == 'coal' || theme == 'navy') { |
| 331 | stylesheets.ayuHighlight.disabled = true; |
| 332 | stylesheets.tomorrowNight.disabled = false; |
| 333 | stylesheets.highlight.disabled = true; |
| 334 | |
| 335 | ace_theme = "ace/theme/tomorrow_night"; |
| 336 | } else if (theme == 'ayu') { |
| 337 | stylesheets.ayuHighlight.disabled = false; |
| 338 | stylesheets.tomorrowNight.disabled = true; |
| 339 | stylesheets.highlight.disabled = true; |
| 340 | ace_theme = "ace/theme/tomorrow_night"; |
| 341 | } else { |
| 342 | stylesheets.ayuHighlight.disabled = true; |
| 343 | stylesheets.tomorrowNight.disabled = true; |
| 344 | stylesheets.highlight.disabled = false; |
| 345 | ace_theme = "ace/theme/dawn"; |
| 346 | } |
| 347 | |
| 348 | setTimeout(function () { |
| 349 | themeColorMetaTag.content = getComputedStyle(document.documentElement).backgroundColor; |
| 350 | }, 1); |
| 351 | |
| 352 | if (window.ace && window.editors) { |
| 353 | window.editors.forEach(function (editor) { |
| 354 | editor.setTheme(ace_theme); |
| 355 | }); |
| 356 | } |
| 357 | |
| 358 | var previousTheme = get_theme(); |
| 359 | |
| 360 | if (store) { |
| 361 | try { localStorage.setItem('mdbook-theme', theme); } catch (e) { } |
| 362 | } |
| 363 | |
| 364 | html.classList.remove(previousTheme); |
| 365 | html.classList.add(theme); |
| 366 | updateThemeSelected(); |
| 367 | } |
| 368 | |
| 369 | // Set theme |
| 370 | var theme = get_theme(); |
no test coverage detected