mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-15 09:44:03 +02:00
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.
This commit is contained in:
parent
a9e439bce1
commit
8121bc0dd2
@ -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}"`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user