Skip to content

Commit db9aae3

Browse files
committed
feat: enhance toggle button functionality and adjust background opacity for improved visibility
1 parent 646ec7f commit db9aae3

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

ascii-bg.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@
259259
// ── Toggle button ────────────────────────────────────────────────────────────
260260

261261
const TOGGLE_LABELS = { ascii: '[ life ]', gol: '[ matrix ]' };
262+
// ASCII-only pool for button glitch — avoids double-width CJK glyphs shifting layout
263+
const BTN_CHARS = '0123456789ABCDEFabcdef+x=[]{}|/<>?!#$%';
264+
function rbchar() { return BTN_CHARS[Math.random() * BTN_CHARS.length | 0]; }
262265

263266
function buildLabel(btn, label) {
264267
btn.innerHTML = '';
@@ -279,7 +282,7 @@
279282
setInterval(() => {
280283
for (const s of btn.querySelectorAll('span')) {
281284
if (Math.random() < 0.14) {
282-
s.textContent = rchar();
285+
s.textContent = rbchar();
283286
setTimeout(() => { s.textContent = s.dataset.orig; }, 80);
284287
}
285288
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
display: block;
155155
padding: 1rem 1rem 1rem 1.1rem;
156156
border-left: 2px solid var(--border);
157-
background: rgba(7, 7, 6, 0.2);
157+
background: rgba(7, 7, 6, 0.6);
158158
text-decoration: none;
159159
transition: background 0.15s, border-color 0.15s;
160160
}

0 commit comments

Comments
 (0)