forked from bm-coelho/ugl-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
51 lines (45 loc) · 1.46 KB
/
index.html
File metadata and controls
51 lines (45 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html lang="pt">
<head>
<meta charset="UTF-8" />
<link
rel="icon"
type="image/x-icon"
href="/favicon-light.ico"
id="favicon"
/>
<!-- <link href="/src/assets/logos/ugl-glass-only-logo-dark.webp" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>UGL - Usp Game Link</title>
</head>
<body>
<div id="root"></div>
<!-- Change icon when in darkmode -->
<script>
const lightIcon = '/favicon-light.ico';
const darkIcon = '/favicon-dark.ico';
// Function to check the user's color scheme preference
function isDarkMode() {
return (
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
);
}
// Function to set the favicon based on dark mode preference
function setFavicon() {
const faviconElement = document.getElementById('favicon');
if (faviconElement) {
const faviconPath = isDarkMode() ? lightIcon : darkIcon;
faviconElement.setAttribute('href', faviconPath);
}
}
// Initially set the favicon based on the user's color scheme preference
setFavicon();
// Listen for changes in color scheme preference
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', setFavicon);
</script>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>