Merge pull request #20999 from Snuffleupagus/getRGB-rgba-split-limit

Remove a tiny bit of unnecessary "rgba" parsing in the `getRGB` function
This commit is contained in:
Jonas Jenwald 2026-03-29 14:04:52 +02:00 committed by GitHub
commit 5d2c4ed211
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -604,9 +604,8 @@ function getRGB(color) {
if (color.startsWith("rgba(")) {
return color
.slice(/* "rgba(".length */ 5, -1) // Strip out "rgba(" and ")".
.split(",")
.map(x => parseInt(x))
.slice(0, 3);
.split(",", 3)
.map(x => parseInt(x));
}
warn(`Not a valid color format: "${color}"`);