mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-05 14:45:50 +02:00
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:
commit
5d2c4ed211
@ -604,9 +604,8 @@ function getRGB(color) {
|
|||||||
if (color.startsWith("rgba(")) {
|
if (color.startsWith("rgba(")) {
|
||||||
return color
|
return color
|
||||||
.slice(/* "rgba(".length */ 5, -1) // Strip out "rgba(" and ")".
|
.slice(/* "rgba(".length */ 5, -1) // Strip out "rgba(" and ")".
|
||||||
.split(",")
|
.split(",", 3)
|
||||||
.map(x => parseInt(x))
|
.map(x => parseInt(x));
|
||||||
.slice(0, 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
warn(`Not a valid color format: "${color}"`);
|
warn(`Not a valid color format: "${color}"`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user