diff --git a/frontend/js/map.js b/frontend/js/map.js index 8db604e..6b93531 100644 --- a/frontend/js/map.js +++ b/frontend/js/map.js @@ -352,8 +352,12 @@ function _tmX(ctx, cx, cy, r, col) { } // ── True-3D colour helpers ──────────────────────────────────────────────── -function _h2r(hex) { // hex → [r,g,b] - hex = hex.replace('#',''); +function _h2r(hex) { // hex or rgb() → [r,g,b] + if (typeof hex === 'string' && hex.startsWith('rgb')) { + const m = hex.match(/\d+/g); + return m ? [+m[0], +m[1], +m[2]] : [0, 0, 0]; + } + hex = (hex || '').replace('#',''); if (hex.length === 3) hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; return [parseInt(hex.slice(0,2),16), parseInt(hex.slice(2,4),16), parseInt(hex.slice(4,6),16)]; }