autobrr/web/index.html
Fabricio Silva 6c2f3a4b2b
fix(web): set theme before app loads (#1017)
* chore(web): toggle classList instead of add and remove

* fix(web): set theme before the app loads
2023-07-21 18:00:34 +02:00

35 lines
No EOL
1.5 KiB
HTML

<!--
~ Copyright (c) 2021 - 2023, Ludvig Lundgren and the autobrr contributors.
~ SPDX-License-Identifier: GPL-2.0-or-later
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#141415" />
<meta name="description" content="autobrr" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon-iphone-60x60.png" />
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-ipad-76x76.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-iphone-retina-120x120.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-ipad-retina-152x152.png" />
<title>autobrr</title>
<base href="{{.BaseUrl}}">
<script>
window.APP = {};
window.APP.baseUrl = "{{.BaseUrl}}";
const browserPrefers = !(window.matchMedia !== undefined && window.matchMedia("(prefers-color-scheme: light)").matches);
const { darkTheme = browserPrefers } = JSON.parse(localStorage.getItem("settings")) || {};
document.documentElement.classList.toggle("dark", darkTheme);
</script>
</head>
<body class="bg-color">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" class="pattern"></div>
<script type="module" src="./src/index.tsx"></script>
</body>
</html>