|
35 | 35 | <script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
|
36 | 36 | <script src="../site_libs/quarto-html/anchor.min.js"></script>
|
37 | 37 | <link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
|
38 |
| -<link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"> |
| 38 | +<link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles"> |
| 39 | +<link href="../site_libs/quarto-html/quarto-syntax-highlighting-dark.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles"> |
39 | 40 | <script src="../site_libs/bootstrap/bootstrap.min.js"></script>
|
40 | 41 | <link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
41 |
| -<link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light"> |
| 42 | +<link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light"> |
| 43 | +<link href="../site_libs/bootstrap/bootstrap-dark.min.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark"> |
42 | 44 | <script id="quarto-search-options" type="application/json">{
|
43 | 45 | "location": "navbar",
|
44 | 46 | "copy-button": false,
|
|
88 | 90 | </li>
|
89 | 91 | </ul>
|
90 | 92 | <div class="quarto-navbar-tools">
|
| 93 | + <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a> |
91 | 94 | </div>
|
92 | 95 | </div> <!-- /navcollapse -->
|
93 | 96 | </div> <!-- /container-fluid -->
|
@@ -142,6 +145,121 @@ <h2 class="anchored" data-anchor-id="development-files">development files</h2>
|
142 | 145 | }
|
143 | 146 | }
|
144 | 147 | toggleBodyColorPrimary();
|
| 148 | + const disableStylesheet = (stylesheets) => { |
| 149 | + for (let i=0; i < stylesheets.length; i++) { |
| 150 | + const stylesheet = stylesheets[i]; |
| 151 | + stylesheet.rel = 'prefetch'; |
| 152 | + } |
| 153 | + } |
| 154 | + const enableStylesheet = (stylesheets) => { |
| 155 | + for (let i=0; i < stylesheets.length; i++) { |
| 156 | + const stylesheet = stylesheets[i]; |
| 157 | + stylesheet.rel = 'stylesheet'; |
| 158 | + } |
| 159 | + } |
| 160 | + const manageTransitions = (selector, allowTransitions) => { |
| 161 | + const els = window.document.querySelectorAll(selector); |
| 162 | + for (let i=0; i < els.length; i++) { |
| 163 | + const el = els[i]; |
| 164 | + if (allowTransitions) { |
| 165 | + el.classList.remove('notransition'); |
| 166 | + } else { |
| 167 | + el.classList.add('notransition'); |
| 168 | + } |
| 169 | + } |
| 170 | + } |
| 171 | + const toggleColorMode = (alternate) => { |
| 172 | + // Switch the stylesheets |
| 173 | + const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate'); |
| 174 | + manageTransitions('#quarto-margin-sidebar .nav-link', false); |
| 175 | + if (alternate) { |
| 176 | + enableStylesheet(alternateStylesheets); |
| 177 | + for (const sheetNode of alternateStylesheets) { |
| 178 | + if (sheetNode.id === "quarto-bootstrap") { |
| 179 | + toggleBodyColorMode(sheetNode); |
| 180 | + } |
| 181 | + } |
| 182 | + } else { |
| 183 | + disableStylesheet(alternateStylesheets); |
| 184 | + toggleBodyColorPrimary(); |
| 185 | + } |
| 186 | + manageTransitions('#quarto-margin-sidebar .nav-link', true); |
| 187 | + // Switch the toggles |
| 188 | + const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle'); |
| 189 | + for (let i=0; i < toggles.length; i++) { |
| 190 | + const toggle = toggles[i]; |
| 191 | + if (toggle) { |
| 192 | + if (alternate) { |
| 193 | + toggle.classList.add("alternate"); |
| 194 | + } else { |
| 195 | + toggle.classList.remove("alternate"); |
| 196 | + } |
| 197 | + } |
| 198 | + } |
| 199 | + // Hack to workaround the fact that safari doesn't |
| 200 | + // properly recolor the scrollbar when toggling (#1455) |
| 201 | + if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) { |
| 202 | + manageTransitions("body", false); |
| 203 | + window.scrollTo(0, 1); |
| 204 | + setTimeout(() => { |
| 205 | + window.scrollTo(0, 0); |
| 206 | + manageTransitions("body", true); |
| 207 | + }, 40); |
| 208 | + } |
| 209 | + } |
| 210 | + const isFileUrl = () => { |
| 211 | + return window.location.protocol === 'file:'; |
| 212 | + } |
| 213 | + const hasAlternateSentinel = () => { |
| 214 | + let styleSentinel = getColorSchemeSentinel(); |
| 215 | + if (styleSentinel !== null) { |
| 216 | + return styleSentinel === "alternate"; |
| 217 | + } else { |
| 218 | + return false; |
| 219 | + } |
| 220 | + } |
| 221 | + const setStyleSentinel = (alternate) => { |
| 222 | + const value = alternate ? "alternate" : "default"; |
| 223 | + if (!isFileUrl()) { |
| 224 | + window.localStorage.setItem("quarto-color-scheme", value); |
| 225 | + } else { |
| 226 | + localAlternateSentinel = value; |
| 227 | + } |
| 228 | + } |
| 229 | + const getColorSchemeSentinel = () => { |
| 230 | + if (!isFileUrl()) { |
| 231 | + const storageValue = window.localStorage.getItem("quarto-color-scheme"); |
| 232 | + return storageValue != null ? storageValue : localAlternateSentinel; |
| 233 | + } else { |
| 234 | + return localAlternateSentinel; |
| 235 | + } |
| 236 | + } |
| 237 | + let localAlternateSentinel = 'default'; |
| 238 | + // Dark / light mode switch |
| 239 | + window.quartoToggleColorScheme = () => { |
| 240 | + // Read the current dark / light value |
| 241 | + let toAlternate = !hasAlternateSentinel(); |
| 242 | + toggleColorMode(toAlternate); |
| 243 | + setStyleSentinel(toAlternate); |
| 244 | + }; |
| 245 | + // Ensure there is a toggle, if there isn't float one in the top right |
| 246 | + if (window.document.querySelector('.quarto-color-scheme-toggle') === null) { |
| 247 | + const a = window.document.createElement('a'); |
| 248 | + a.classList.add('top-right'); |
| 249 | + a.classList.add('quarto-color-scheme-toggle'); |
| 250 | + a.href = ""; |
| 251 | + a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; }; |
| 252 | + const i = window.document.createElement("i"); |
| 253 | + i.classList.add('bi'); |
| 254 | + a.appendChild(i); |
| 255 | + window.document.body.appendChild(a); |
| 256 | + } |
| 257 | + // Switch to dark mode if need be |
| 258 | + if (hasAlternateSentinel()) { |
| 259 | + toggleColorMode(true); |
| 260 | + } else { |
| 261 | + toggleColorMode(false); |
| 262 | + } |
145 | 263 | const icon = "";
|
146 | 264 | const anchorJS = new window.AnchorJS();
|
147 | 265 | anchorJS.options = {
|
|
0 commit comments