Skip to content

Commit 8121bc0

Browse files
committed
Remove a tiny bit of unnecessary "rgba" parsing in the getRGB function
This obviously won't matter in practice, however it seems more "correct" to only extract the necessary number of color components rather than slicing off excess ones at the end.
1 parent a9e439b commit 8121bc0

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)