We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Percentage RGB color (e.g. <path style="fill:rgb(100%,100%,100%);">) is not rendering.
<path style="fill:rgb(100%,100%,100%);">
The text was updated successfully, but these errors were encountered:
Here's a script to replace the % format to the 255.
//Find if there is any percentage RGB const regexRGB = /rgba?\s*\(\s*(\d{1,3})\%\s*\,\s*(\d{1,3})\%\s*\,\s*(\d{1,3})\%\s*\,*\s*(?:,\s*(\d?(?:\.\d+)?))?\s*\)/gm; let m; while ((m = regexRGB.exec(stringSVG)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regexRGB.lastIndex) { regexRGB.lastIndex++; } rgb = m[0] r = m[1], g = m[2], b = m[3], a = m[4] new_r = Math.round(255 * (parseInt(r) / 100)) new_g = Math.round(255 * (parseInt(g) / 100)) new_b = Math.round(255 * (parseInt(b) / 100)) new_rgb = 'rgb(' + new_r.toString() + ',' + new_g.toString() + ',' + new_b.toString() + ')' if (a) { new_rgb = 'rgba(' + new_r.toString() + ',' + new_g.toString() + ',' + new_b.toString() + ',' + a.toString() + ')' } stringSVG = stringSVG.replace(rgb, new_rgb) }
Sorry, something went wrong.
Great!
No branches or pull requests
Percentage RGB color (e.g.
<path style="fill:rgb(100%,100%,100%);">
) is not rendering.The text was updated successfully, but these errors were encountered: