forked from dasniko/keycloak-reactjs-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
26 lines (26 loc) · 876 Bytes
/
index.html
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
<!DOCTYPE html>
<html data-bs-theme="auto">
<head>
<meta charset="utf-8">
<title>React Keycloak Example</title>
<link rel="stylesheet" href="/bootstrap.min.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="app">Loading application...</div>
<script type="module" src="/src/index.jsx"></script>
<script>
(function () {
const htmlElement = document.querySelector("html")
if(htmlElement.getAttribute("data-bs-theme") === 'auto') {
function updateTheme() {
document.querySelector("html").setAttribute("data-bs-theme",
window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme);
updateTheme();
}
})()
</script>
</body>
</html>