Skip to content

Commit 9c2a46c

Browse files
committed
fix
1 parent d6b25f4 commit 9c2a46c

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{% include v1/footer.html %}
3838
</footer>
3939
{% if page.url == '/' or page.url == '/index.html' %}
40-
<script src="{{ '/assets/js/ascii-bg.js' | relative_url }}?v=ascii-png-bg-20260329-2"></script>
40+
<script src="{{ '/assets/js/ascii-bg.js' | relative_url }}?v=ascii-mobile-dark-20260329-4"></script>
4141
{% endif %}
4242
<script src="{{ '/assets/js/terminal-tilt.js' | relative_url }}"></script>
4343
</body>

assets/js/ascii-bg.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,28 @@
3434
const dh = ih * scale;
3535
const dx = (state.w - dw) * 0.5;
3636
const dy = (state.h - dh) * 0.5;
37+
const mobile = Math.max(0, Math.min(1, state.w / 900));
3738

38-
// Near-black but visible. No animation.
39-
ctx.filter = "grayscale(1) contrast(1.05) brightness(0.20)";
40-
ctx.globalAlpha = 0.9;
39+
// Near-black but visible, with stronger darkening on mobile.
40+
const brightness = 0.14 + mobile * 0.06; // ~0.166 on iPhone widths, ~0.20 desktop
41+
const baseAlpha = 0.62 + mobile * 0.28; // reduce image weight on smaller screens
42+
ctx.filter = `grayscale(1) contrast(1.05) brightness(${brightness.toFixed(3)})`;
43+
ctx.globalAlpha = baseAlpha;
4144
ctx.drawImage(img, dx, dy, dw, dh);
4245

4346
// Slight dark veil so foreground content stays readable.
4447
ctx.filter = "none";
4548
ctx.globalAlpha = 1;
46-
ctx.fillStyle = "rgba(0, 0, 0, 0.35)";
49+
const veil = 0.62 - mobile * 0.20; // stronger veil on mobile
50+
ctx.fillStyle = `rgba(0, 0, 0, ${veil.toFixed(3)})`;
4751
ctx.fillRect(0, 0, state.w, state.h);
4852

4953
// Fade out toward the lower section so the art tapers off naturally.
50-
const fadeBottom = ctx.createLinearGradient(0, state.h * 0.52, 0, state.h);
54+
const fadeStart = state.h * (0.44 + mobile * 0.08);
55+
const fadeBottom = ctx.createLinearGradient(0, fadeStart, 0, state.h);
5156
fadeBottom.addColorStop(0, "rgba(0, 0, 0, 0)");
52-
fadeBottom.addColorStop(0.45, "rgba(0, 0, 0, 0.32)");
53-
fadeBottom.addColorStop(1, "rgba(0, 0, 0, 0.72)");
57+
fadeBottom.addColorStop(0.45, "rgba(0, 0, 0, 0.40)");
58+
fadeBottom.addColorStop(1, "rgba(0, 0, 0, 0.84)");
5459
ctx.fillStyle = fadeBottom;
5560
ctx.fillRect(0, 0, state.w, state.h);
5661

0 commit comments

Comments
 (0)