Spaces:
Running on Zero
Running on Zero
Guide follows the Space page's theme (Scrolls PR #310)
Browse files- guide/index.html +8 -2
guide/index.html
CHANGED
|
@@ -257,6 +257,13 @@ html.lbopen{overflow:hidden}
|
|
| 257 |
details.fold>.inner{padding:0 14px 14px}
|
| 258 |
}
|
| 259 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
</head>
|
| 261 |
<body>
|
| 262 |
<header class="hero" id="top">
|
|
@@ -447,8 +454,7 @@ const esc=s=>s.replace(/&/g,'&').replace(/</g,'<');
|
|
| 447 |
let cur=0,view='xy',ut='connect';
|
| 448 |
|
| 449 |
/* theme */
|
| 450 |
-
(function(){
|
| 451 |
-
if(t)document.documentElement.dataset.theme=t;
|
| 452 |
$('theme').onclick=()=>{const dark=document.documentElement.dataset.theme?document.documentElement.dataset.theme==='dark':matchMedia('(prefers-color-scheme: dark)').matches;
|
| 453 |
const n=dark?'light':'dark';document.documentElement.dataset.theme=n;try{localStorage.setItem('lf-theme',n)}catch(e){}};})();
|
| 454 |
|
|
|
|
| 257 |
details.fold>.inner{padding:0 14px 14px}
|
| 258 |
}
|
| 259 |
</style>
|
| 260 |
+
<script>
|
| 261 |
+
// Theme before first paint: the viewer's saved choice (the Theme button), else the theme the Space page was opened
|
| 262 |
+
// with (Gradio follows Hugging Face's ?__theme=, which Hugging Face keeps with the account), else the system setting.
|
| 263 |
+
(function(){var t=null;try{t=localStorage.getItem('lf-theme')}catch(e){}
|
| 264 |
+
if(t!=='light'&&t!=='dark'){try{t=new URLSearchParams(parent.location.search).get('__theme')}catch(e){t=null}}
|
| 265 |
+
if(t==='light'||t==='dark')document.documentElement.dataset.theme=t;})();
|
| 266 |
+
</script>
|
| 267 |
</head>
|
| 268 |
<body>
|
| 269 |
<header class="hero" id="top">
|
|
|
|
| 454 |
let cur=0,view='xy',ut='connect';
|
| 455 |
|
| 456 |
/* theme */
|
| 457 |
+
(function(){/* the saved choice, or the Space page's theme, is applied in <head>, before first paint */
|
|
|
|
| 458 |
$('theme').onclick=()=>{const dark=document.documentElement.dataset.theme?document.documentElement.dataset.theme==='dark':matchMedia('(prefers-color-scheme: dark)').matches;
|
| 459 |
const n=dark?'light':'dark';document.documentElement.dataset.theme=n;try{localStorage.setItem('lf-theme',n)}catch(e){}};})();
|
| 460 |
|