Skip to content

Commit 5d2c4ed

Browse files
Merge pull request #20999 from Snuffleupagus/getRGB-rgba-split-limit
Remove a tiny bit of unnecessary "rgba" parsing in the `getRGB` function
2 parents a9e439b + 8121bc0 commit 5d2c4ed

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/display/display_utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,8 @@ function getRGB(color) {
604604
if (color.startsWith("rgba(")) {
605605
return color
606606
.slice(/* "rgba(".length */ 5, -1) // Strip out "rgba(" and ")".
607-
.split(",")
608-
.map(x => parseInt(x))
609-
.slice(0, 3);
607+
.split(",", 3)
608+
.map(x => parseInt(x));
610609
}
611610

612611
warn(`Not a valid color format: "${color}"`);

0 commit comments

Comments
 (0)