← back to Wallco Ai
Fix apcaLc hex parser to handle 3-char shortcuts (#fff, #000) — was returning NaN for half the bands; same bug existed in figma frame generator + Figma file rebuilt with correct palettes
ba8727598e370e2e381bb8569859c0e01daf6ca2 · 2026-05-11 20:04:22 -0700 · Steve Abrams
Files touched
Diff
commit ba8727598e370e2e381bb8569859c0e01daf6ca2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon May 11 20:04:22 2026 -0700
Fix apcaLc hex parser to handle 3-char shortcuts (#fff, #000) — was returning NaN for half the bands; same bug existed in figma frame generator + Figma file rebuilt with correct palettes
---
server.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/server.js b/server.js
index 5b855da..79f517c 100644
--- a/server.js
+++ b/server.js
@@ -2172,7 +2172,8 @@ ${HAMBURGER_JS}
// Returns signed Lc value: positive = dark text on light bg, negative = light on dark.
// |Lc| ≥ 60 = comfortably readable for body, ≥ 45 for UI components, ≥ 75 for fine print.
function apcaLc(textHex, bgHex) {
- const hexToRgb = h => (h.replace('#','').match(/.{2}/g) || []).map(x => parseInt(x, 16));
+ const expand = h => { h = h.replace('#',''); return h.length === 3 ? h.split('').map(c => c+c).join('') : h; };
+ const hexToRgb = h => { const x = expand(h); return [parseInt(x.slice(0,2),16), parseInt(x.slice(2,4),16), parseInt(x.slice(4,6),16)]; };
const sRGBtoY = ([r,g,b]) =>
0.2126729 * Math.pow(r/255, 2.4) + 0.7151522 * Math.pow(g/255, 2.4) + 0.0721750 * Math.pow(b/255, 2.4);
const BlkThrs = 0.022, BlkClmp = 1.414, LoConThresh = 0.1;
← 9de55cd bake → redirect: nginx body limit + Express json limit + sna
·
back to Wallco Ai
·
wallco.ai: Gmail draft to Corey with 6 SDXL trellis+butterfl 25e633c →