From 1bc26429f2e63c7db463036735b3380c6ff1d6d7 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 17 Jun 2026 21:59:12 +0200 Subject: [PATCH] dashboard(home): harden matrix-rain fade-trail colour parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to the matrix-rain backdrop (merged): address argus's review nit on the fadeColor construction. It string-rewrote `rgb(...)`→`rgba(...)`, which silently fills the trail solid if getComputedStyle ever returns a non-`rgb(r, g, b)` form. Extract r,g,b numerically and build the rgba explicitly so the trail always fades regardless of the returned format (same rgb fallback end-to-end). CSS/JS-only, home page. --- frontend/packages/dashboard/src/home.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/packages/dashboard/src/home.js b/frontend/packages/dashboard/src/home.js index 944c6d1d..70b13dc6 100644 --- a/frontend/packages/dashboard/src/home.js +++ b/frontend/packages/dashboard/src/home.js @@ -78,8 +78,14 @@ function startMatrixRain() { return /^rgb/.test(c) ? c : fallback; } const glyphColor = resolveColor('--green', 'rgb(166, 227, 161)'); - const fadeColor = resolveColor('--bg', 'rgb(30, 30, 46)') - .replace(/^rgb\(/, 'rgba(').replace(/\)$/, ', 0.09)'); + // Fade-trail = the bg at low alpha. Pull r,g,b numerically rather than + // string-rewriting the rgb() — robust to whatever rgb()/rgba() spacing + // getComputedStyle hands back, so the trail always fades (never fills + // solid) even if the format shifts. + const bgRGB = resolveColor('--bg', 'rgb(30, 30, 46)').match(/(\d+)[^\d]+(\d+)[^\d]+(\d+)/); + const fadeColor = bgRGB + ? `rgba(${bgRGB[1]}, ${bgRGB[2]}, ${bgRGB[3]}, 0.09)` + : 'rgba(30, 30, 46, 0.09)'; const GLYPHS = 'アイウエオカキクケコサシスセソタチツテト0123456789:=*+-<>¦'; const CELL = 16; // glyph cell size (px)