From a239633fae10dc29174e3b23133e7ff92dc7435f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 12 Feb 2024 10:17:57 +0100 Subject: [PATCH] feat: change threshold to switch black SVG img to white --- umap/static/umap/js/umap.core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 092018d3..ba6a7118 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -410,7 +410,8 @@ L.DomUtil.contrastedColor = (el, bgcolor) => { rgb = L.DomUtil.RGBRegex.exec(rgb) if (!rgb || rgb.length !== 4) return out rgb = parseInt(rgb[1], 10) + parseInt(rgb[2], 10) + parseInt(rgb[3], 10) - if (rgb < (255 * 3) / 2) out = 1 + const threshold = 140 + if (rgb < threshold * 3) out = 1 if (bgcolor) _CACHE_CONSTRAST[bgcolor] = out return out }