feat: change threshold to switch black SVG img to white

This commit is contained in:
Yohan Boniface 2024-02-12 10:17:57 +01:00
parent 148c119c05
commit a239633fae

View file

@ -410,7 +410,8 @@ L.DomUtil.contrastedColor = (el, bgcolor) => {
rgb = L.DomUtil.RGBRegex.exec(rgb) rgb = L.DomUtil.RGBRegex.exec(rgb)
if (!rgb || rgb.length !== 4) return out if (!rgb || rgb.length !== 4) return out
rgb = parseInt(rgb[1], 10) + parseInt(rgb[2], 10) + parseInt(rgb[3], 10) 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 if (bgcolor) _CACHE_CONSTRAST[bgcolor] = out
return out return out
} }