-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
40 lines (39 loc) · 1.11 KB
/
Copy pathindex.html
File metadata and controls
40 lines (39 loc) · 1.11 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Color</title>
<style>
main {
background-color: red;
color: white;
text-align: center;
height: 990px;
}
body {
margin: 0px
}
</style>
</head>
<body>
<main>This is a text</main>
<script src="dist/client.min.js"></script>
<script>
let element = document.querySelector('main')
let ts = new Themer.ThemeSwitcher()
ts.init()
window.addEventListener('theme-switched', (payload) => {
if(payload.detail.theme === 'light') {
element.style.backgroundColor = '#fff'
element.style.color = 'black'
element.innerHTML = 'Light theme has been detected!'
} else {
element.style.backgroundColor = '#000'
element.style.color = 'white'
element.innerHTML = 'Dark theme has been detected!'
}
})
</script>
</body>
</html>