Maybe use https://github.com/WebReflection/linkedom for
|
svg = svg.replace( |
|
'fill="#000000" stroke="none"', |
|
`fill="rgb(${r},${g},${b})" stroke="rgb(${r},${g},${b})"${ |
|
a === '255' |
|
? '' |
|
: ` fill-opacity="${alpha}" stroke-opacity="${alpha}"` |
|
} stroke-width="${params.strokeWidth}px"`, |
|
); |
|
const pathRegEx = /<path\s*d="([^"]+)"\/>/g; |
|
let matches; |
|
const shortPaths = []; |
|
while ((matches = pathRegEx.exec(svg)) !== null) { |
|
const path = matches[1]; |
|
if (path.split(' ').length < params.minPathSegments) { |
|
shortPaths.push(matches[0]); |
|
} |
|
} |
|
shortPaths.forEach((path) => { |
|
svg = svg.replace(path, ''); |
|
}); |
.
Maybe use https://github.com/WebReflection/linkedom for
SVGcode/src/js/colorworker.js
Lines 69 to 88 in 1def07e