-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
237 lines (212 loc) · 17.7 KB
/
index.html
File metadata and controls
237 lines (212 loc) · 17.7 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HexGuessr</title>
<!-- Dark mode init: runs immediately to prevent flash -->
<script>
(function() {
// Check localStorage first
const savedTheme = localStorage.getItem('theme');
let shouldBeDark = false;
if (savedTheme === 'dark') {
shouldBeDark = true;
} else if (savedTheme === 'light') {
shouldBeDark = false;
} else {
// No saved preference, check system preference
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
shouldBeDark = true;
}
// If can't detect or is light, shouldBeDark stays false (default light)
// Save the detected preference so it persists across mode switches
localStorage.setItem('theme', shouldBeDark ? 'dark' : 'light');
}
if (shouldBeDark) {
document.documentElement.classList.add('dark');
}
// During full-page mode navigation, paint the pre-CSS frame
// using the same background as the active theme.
document.documentElement.style.backgroundColor = shouldBeDark ? '#262626' : '#f5f5f5';
document.documentElement.style.colorScheme = shouldBeDark ? 'dark' : 'light';
})();
</script>
<!-- Favicons -->
<link rel="icon" href="/favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png">
<link rel="stylesheet" href="styles.css">
<script src="app.js" defer></script>
</head>
<body class="">
<!-- Icon Generation -->
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
<symbol id="icon-question" viewBox="0 0 15 15">
<g fill="currentColor" shape-rendering="crispEdges">
<rect x="2" y="0" width="11" height="1" /><rect x="1" y="1" width="13" height="1" /><rect x="0" y="2" width="15" height="1" /><rect x="0" y="3" width="15" height="1" /><rect x="0" y="4" width="5" height="1" /><rect x="11" y="4" width="4" height="1" /><rect x="1" y="5" width="3" height="1" /><rect x="11" y="5" width="4" height="1" /><rect x="7" y="6" width="8" height="1" /><rect x="6" y="7" width="8" height="1" /><rect x="5" y="8" width="8" height="1" /><rect x="5" y="9" width="5" height="1" /><rect x="5" y="10" width="5" height="1" /><rect x="5" y="12" width="5" height="1" /><rect x="5" y="13" width="5" height="1" /><rect x="6" y="14" width="3" height="1" />
</g>
</symbol>
<symbol id="icon-copy" viewBox="0 0 15 15">
<g fill="currentColor">
<rect x="1" y="1" width="10" height="1"/><rect x="1" y="2" width="10" height="1"/><rect x="1" y="3" width="2" height="1"/><rect x="9" y="3" width="2" height="1"/><rect x="12" y="3" width="2" height="1"/><rect x="1" y="4" width="2" height="1"/><rect x="9" y="4" width="2" height="1"/><rect x="12" y="4" width="2" height="1"/><rect x="1" y="5" width="2" height="1"/><rect x="9" y="5" width="2" height="1"/><rect x="12" y="5" width="2" height="1"/><rect x="1" y="6" width="2" height="1"/><rect x="9" y="6" width="2" height="1"/><rect x="12" y="6" width="2" height="1"/><rect x="1" y="7" width="2" height="1"/><rect x="9" y="7" width="2" height="1"/><rect x="12" y="7" width="2" height="1"/><rect x="1" y="8" width="2" height="1"/><rect x="9" y="8" width="2" height="1"/><rect x="12" y="8" width="2" height="1"/><rect x="1" y="9" width="10" height="1"/><rect x="12" y="9" width="2" height="1"/><rect x="1" y="10" width="10" height="1"/><rect x="12" y="10" width="2" height="1"/><rect x="12" y="11" width="2" height="1"/><rect x="3" y="12" width="11" height="1"/><rect x="3" y="13" width="11" height="1"/>
</g>
</symbol>
<symbol id="icon-paste" viewBox="0 0 15 15">
<g fill="currentColor">
<rect x="6" y="0" width="3" height="1"/><rect x="5" y="1" width="2" height="1"/><rect x="8" y="1" width="2" height="1"/><rect x="3" y="2" width="9" height="1"/><rect x="2" y="3" width="2" height="1"/><rect x="11" y="3" width="2" height="1"/><rect x="2" y="4" width="1" height="1"/><rect x="12" y="4" width="1" height="1"/><rect x="2" y="5" width="1" height="1"/><rect x="4" y="5" width="7" height="1"/><rect x="12" y="5" width="1" height="1"/><rect x="2" y="6" width="1" height="1"/><rect x="12" y="6" width="1" height="1"/><rect x="2" y="7" width="1" height="1"/><rect x="4" y="7" width="7" height="1"/><rect x="12" y="7" width="1" height="1"/><rect x="2" y="8" width="1" height="1"/><rect x="12" y="8" width="1" height="1"/><rect x="2" y="9" width="1" height="1"/><rect x="4" y="9" width="7" height="1"/><rect x="12" y="9" width="1" height="1"/><rect x="2" y="10" width="1" height="1"/><rect x="12" y="10" width="1" height="1"/><rect x="2" y="11" width="1" height="1"/><rect x="4" y="11" width="7" height="1"/><rect x="12" y="11" width="1" height="1"/><rect x="2" y="12" width="1" height="1"/><rect x="12" y="12" width="1" height="1"/><rect x="2" y="13" width="2" height="1"/><rect x="11" y="13" width="2" height="1"/><rect x="3" y="14" width="9" height="1"/>
</g>
</symbol>
<symbol id="icon-stats" viewBox="0 0 15 15">
<g fill="currentColor">
<rect x="8" y="0" width="3" height="1"/><rect x="8" y="1" width="3" height="1"/><rect x="8" y="2" width="3" height="1"/><rect x="4" y="3" width="3" height="1"/><rect x="8" y="3" width="3" height="1"/><rect x="4" y="4" width="3" height="1"/><rect x="8" y="4" width="3" height="1"/><rect x="4" y="5" width="3" height="1"/><rect x="8" y="5" width="3" height="1"/><rect x="4" y="6" width="3" height="1"/><rect x="8" y="6" width="3" height="1"/><rect x="0" y="7" width="3" height="1"/><rect x="4" y="7" width="3" height="1"/><rect x="8" y="7" width="3" height="1"/><rect x="0" y="8" width="3" height="1"/><rect x="4" y="8" width="3" height="1"/><rect x="8" y="8" width="3" height="1"/><rect x="0" y="9" width="3" height="1"/><rect x="4" y="9" width="3" height="1"/><rect x="8" y="9" width="3" height="1"/><rect x="12" y="9" width="3" height="1"/><rect x="0" y="10" width="3" height="1"/><rect x="4" y="10" width="3" height="1"/><rect x="8" y="10" width="3" height="1"/><rect x="12" y="10" width="3" height="1"/><rect x="0" y="11" width="3" height="1"/><rect x="4" y="11" width="3" height="1"/><rect x="8" y="11" width="3" height="1"/><rect x="12" y="11" width="3" height="1"/><rect x="0" y="12" width="3" height="1"/><rect x="4" y="12" width="3" height="1"/><rect x="8" y="12" width="3" height="1"/><rect x="12" y="12" width="3" height="1"/><rect x="0" y="13" width="3" height="1"/><rect x="4" y="13" width="3" height="1"/><rect x="8" y="13" width="3" height="1"/><rect x="12" y="13" width="3" height="1"/><rect x="0" y="14" width="3" height="1"/><rect x="4" y="14" width="3" height="1"/><rect x="8" y="14" width="3" height="1"/><rect x="12" y="14" width="3" height="1"/>
</g>
</symbol>
<symbol id="icon-darkmode" viewBox="0 0 15 15">
<g fill="currentColor">
<rect x="5" y="0" width="3" height="1"/><rect x="3" y="1" width="3" height="1"/><rect x="2" y="2" width="3" height="1"/><rect x="1" y="3" width="4" height="1"/><rect x="1" y="4" width="3" height="1"/><rect x="0" y="5" width="4" height="1"/><rect x="0" y="6" width="4" height="1"/><rect x="0" y="7" width="5" height="1"/><rect x="14" y="7" width="1" height="1"/><rect x="0" y="8" width="5" height="1"/><rect x="14" y="8" width="1" height="1"/><rect x="0" y="9" width="6" height="1"/><rect x="13" y="9" width="2" height="1"/><rect x="1" y="10" width="7" height="1"/><rect x="11" y="10" width="3" height="1"/><rect x="1" y="11" width="13" height="1"/><rect x="2" y="12" width="11" height="1"/><rect x="3" y="13" width="9" height="1"/><rect x="5" y="14" width="5" height="1"/>
</g>
</symbol>
<symbol id="icon-lightmode" viewBox="0 0 15 15">
<g fill="currentColor">
<rect x="7" y="0" width="1" height="1"/><rect x="1" y="1" width="1" height="1"/><rect x="7" y="1" width="1" height="1"/><rect x="13" y="1" width="1" height="1"/><rect x="2" y="2" width="1" height="1"/><rect x="12" y="2" width="1" height="1"/><rect x="6" y="3" width="3" height="1"/><rect x="4" y="4" width="7" height="1"/><rect x="4" y="5" width="7" height="1"/><rect x="3" y="6" width="9" height="1"/><rect x="0" y="7" width="2" height="1"/><rect x="3" y="7" width="9" height="1"/><rect x="13" y="7" width="2" height="1"/><rect x="3" y="8" width="9" height="1"/><rect x="4" y="9" width="7" height="1"/><rect x="4" y="10" width="7" height="1"/><rect x="6" y="11" width="3" height="1"/><rect x="2" y="12" width="1" height="1"/><rect x="12" y="12" width="1" height="1"/><rect x="1" y="13" width="1" height="1"/><rect x="7" y="13" width="1" height="1"/><rect x="13" y="13" width="1" height="1"/><rect x="7" y="14" width="1" height="1"/>
</g>
</symbol>
<symbol id="icon-cancel" viewBox="0 0 15 15">
<g fill="currentColor">
<rect x="1" y="1" width="2" height="1"/><rect x="12" y="1" width="2" height="1"/><rect x="1" y="2" width="3" height="1"/><rect x="11" y="2" width="3" height="1"/><rect x="2" y="3" width="3" height="1"/><rect x="10" y="3" width="3" height="1"/><rect x="3" y="4" width="3" height="1"/><rect x="9" y="4" width="3" height="1"/><rect x="4" y="5" width="3" height="1"/><rect x="8" y="5" width="3" height="1"/><rect x="5" y="6" width="5" height="1"/><rect x="6" y="7" width="3" height="1"/> <rect x="5" y="8" width="5" height="1"/><rect x="4" y="9" width="3" height="1"/><rect x="8" y="9" width="3" height="1"/><rect x="3" y="10" width="3" height="1"/><rect x="9" y="10" width="3" height="1"/><rect x="2" y="11" width="3" height="1"/><rect x="10" y="11" width="3" height="1"/><rect x="1" y="12" width="3" height="1"/><rect x="11" y="12" width="3" height="1"/><rect x="1" y="13" width="2" height="1"/><rect x="12" y="13" width="2" height="1"/>
</g>
</symbol>
</svg>
<!-- /Icon Generation -->
<div class="layout-container">
<header class="game-header">
<div class="ascii-wrap">
<pre class="ascii-title">
██╗ ██╗███████╗██╗ ██╗
██║ ██║██╔════╝██║ ██║
███████║█████╗ ╚═███╔═╝
██╔══██║██╔══╝ ██╔══██╗
██║ ██║███████╗██║ ██║
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
███████╗██╗ ██╗███████╗
██╔════╝██║ ██║██╔════╝
██║ ███╗██║ ██║█████╗
██║ ██║██║ ██║██╔══╝
███████║███████║███████╗
╚══════╝╚══════╝╚══════╝
███████╗███████╗███████╗
██╔════╝██╔════╝██╔══██║
███████╗███████╗██████╔╝
╚════██║╚════██║██╔══██╗
███████║███████║██║ ██║
╚══════╝╚══════╝╚═╝ ╚═╝</pre>
</div>
<div class="header-row">
<!-- mode selector buttons -->
<div class="mode-container">
<a class="mode-btn" href="/">Daily</a>
<a class="mode-btn" href="/unlimited">Unlimited</a>
</div>
<div class="top-controls">
<!-- Help / Instructions -->
<button id="infoButton" class="icon-btn" aria-label="How To Play"><svg class="icon" viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-question"></use></svg></button>
<!-- Stats (if you have a stats panel) -->
<button id="statsButton" class="icon-btn" aria-label="Stats"><svg class="icon" viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-stats"></use></svg></button>
<!-- Dark‑mode toggle -->
<button id="darkModeToggle" class="icon-btn" aria-label="Dark Mode"><svg class="icon icon--moon" viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-darkmode"></use></svg><svg class="icon icon--sun" viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-lightmode"></use></svg></button>
</div>
</div>
</header>
<main class="game-container">
<div class="color-game-section">
<div class="custom-color-picker">
<!-- BLUE: reveal square -->
<div class="color-display hidden" id="colorDisplay">
Click to reveal color!
</div>
<!-- GREEN: timer bar under reveal square -->
<div class="timer-bar" id="timerBar">
<div class="timer-fill" id="timerFill"></div>
</div>
<!-- YELLOW + ORANGE: preview + hex input (stacked) -->
<div class="color-controls">
<div class="color-preview" id="colorPreview"></div>
<div class="hex-input-container">
<span class="hex-prefix">#</span>
<input
type="text"
id="hexInputField"
class="hex-input-field"
value="FF5733"
maxlength="6"
>
<button id="copyBtn" class="hex-copy-btn" aria-label="Copy">
<svg class="icon icon--paste" viewBox="0 0 24 24" aria-hidden="true">
<use href="#icon-copy"></use>
</svg>
</button>
</div>
</div>
<!-- RED + PURPLE: canvas + hue slider -->
<div class="color-picker-main">
<div class="color-canvas" id="colorCanvas">
<div class="canvas-cursor" id="canvasCursor"></div>
</div>
<div class="hue-slider" id="hueSlider">
<div class="hue-cursor" id="hueCursor"></div>
</div>
</div>
</div>
</div>
<div class="input-section">
<div class="hex-grid-wrapper">
<div id="hexGrid" class="hex-grid" aria-label="Hex guess grid"></div>
<div class="keyboard-shell">
<div id="hexKeyboard" class="hex-keyboard" aria-label="On-screen hex keyboard">
<div class="keyboard-row">
<button class="key-btn" data-key="0">0</button>
<button class="key-btn" data-key="1">1</button>
<button class="key-btn" data-key="2">2</button>
<button class="key-btn" data-key="3">3</button>
<button class="key-btn" data-key="4">4</button>
<button class="key-btn" data-key="5">5</button>
<button class="key-btn" data-key="6">6</button>
<button class="key-btn" data-key="7">7</button>
<button class="key-btn" data-key="8">8</button>
<button class="key-btn" data-key="9">9</button>
</div>
<div class="keyboard-row">
<button class="key-btn wide-key" data-action="enter">ENTER</button>
<button class="key-btn" data-key="A">A</button>
<button class="key-btn" data-key="B">B</button>
<button class="key-btn" data-key="C">C</button>
<button class="key-btn" data-key="D">D</button>
<button class="key-btn" data-key="E">E</button>
<button class="key-btn" data-key="F">F</button>
<button class="key-btn wide-key" data-action="backspace">DEL</button>
</div>
</div>
</div>
</div>
</div>
<div class="guesses-container" id="guessesContainer"></div>
</main>
</div>
<!-- Reusable Modal -->
<div id="modal" class="modal" style="display: none;">
<div class="modal-overlay"></div>
<div class="modal-content">
<div id="modalBody" class="modal-body">
<!-- Dynamic content with close button will be inserted here -->
</div>
</div>
</div>
<!-- Toast Notification Container -->
<div id="toastContainer" class="toast-container"></div>
<!-- Footer -->
<footer class="site-footer">
<img src="favicon.png" alt="HexGuessr Logo" class="footer-logo">
<span class="footer-text">A game by <a href="https://github.com/kapuuzapuu/" target="_blank" rel="noopener noreferrer">KapuuZapuu</a></span>
</footer>
</body>
</html>