forked from dhairyagothi/100_days_100_web_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme selection
108 lines (106 loc) · 3.96 KB
/
theme selection
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Digital Clock</title>
<link rel="stylesheet" href="digitalclock.css" />
<script src="digitalclock.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-black flex flex-col items-center justify-center h-screen">
<div class="text-center">
<div
id="display"
class="relative font-mono text-4xl md:text-5xl text-white border-4 border-green-500 rounded-lg p-4 mb-4"
></div>
<div
id="clock"
class="relative font-mono text-4xl md:text-5xl text-green-500 border-4 border-green-500 rounded-lg p-4"
></div>
</div>
<div class="mt-10 flex space-x-4">
<button
class="clock-face-btn px-4 py-2 hover:bg-green-700 hover:text-white border-2 border-green-500 text-green-500 rounded-lg"
onclick="setClockStyleAndFormat('classic', 'format1')"
>
Classic
</button>
<button
class="clock-face-btn px-4 py-2 hover:bg-blue-700 border-2 border-blue-500 text-blue-500 rounded-lg hover:text-white"
onclick="setClockStyleAndFormat('modern', 'format2')"
>
Modern
</button>
<button
class="clock-face-btn px-4 py-2 hover:bg-red-700 border-2 border-red-500 text-red-500 rounded-lg hover:text-white"
onclick="setClockStyleAndFormat('futuristic', 'format3')"
>
Futuristic
</button>
</div>
<div class="mt-10">
<select
id="timezone"
class="px-3 hover:bg-green-700 hover:text-white py-2 border-2 border-green-500 text-green-500 rounded-lg"
onchange="updateClock()"
>
<option value="local">Local Time</option>
<option value="UTC">UTC</option>
<option value="America/New_York">New York (USA)</option>
<option value="Europe/London">London (UK)</option>
<option value="Asia/Kolkata">Kolkata (India)</option>
</select>
</div>
<div id="alarm-container" class="mt-10 flex flex-col items-center">
<button
class="hover:text-white clock-face-btn px-4 py-2 hover:bg-yellow-700 border-2 border-yellow-500 text-yellow-500 rounded-lg"
onclick="toggleAlarmMode()"
>
Set Alarm
</button>
<input
type="time"
id="alarm-time"
class="hidden mt-4 px-4 py-2 border-2 border-yellow-500 text-yellow-500 rounded-lg"
/>
<button
class="clock-face-btn hidden mt-4 px-4 py-2 hover:bg-yellow-700 border-2 border-yellow-500 text-yellow-500 rounded-lg"
onclick="setAlarm()"
>
Confirm Alarm
</button>
</div>
<div
id="alarm-popup"
class="hidden fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-black text-yellow-500 border-4 border-yellow-500 rounded-lg p-4"
>
<p>Alarm is ringing!</p>
<button
class="mt-4 px-4 py-2 hover:bg-yellow-700 border-2 border-yellow-500 text-yellow-500 rounded-lg"
onclick="stopAlarm()"
>
Stop Alarm
</button>
</div>
<audio id="alarm-sound" src="alarm.mp3" class="hidden"></audio>
<div class="mt-4">
<label for="theme-toggle" class="text-white">Choose Theme:</label>
<select id="theme-toggle" class="ml-2 px-4 py-2 border-2 border-green-500 text-green-500 rounded-lg">
<option value="light">Light</option>
<option value="dark" selected>Dark</option>
</select>
</div>
<script>
document.getElementById('theme-toggle').addEventListener('change', function () {
if (this.value === 'light') {
document.body.classList.remove('bg-black', 'text-white');
document.body.classList.add('bg-white', 'text-black');
} else {
document.body.classList.remove('bg-white', 'text-black');
document.body.classList.add('bg-black', 'text-white');
}
});
</script>
</body>
</html>