mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Merge pull request #12555 from calixteman/color
Replace css color rgb(...) by #...
This commit is contained in:
commit
3e52098e29
6 changed files with 15 additions and 18 deletions
|
@ -622,16 +622,13 @@ const IsEvalSupportedCached = {
|
|||
},
|
||||
};
|
||||
|
||||
const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
|
||||
const hexNumbers = [...Array(256).keys()].map(n =>
|
||||
n.toString(16).padStart(2, "0")
|
||||
);
|
||||
|
||||
class Util {
|
||||
// makeCssRgb() can be called thousands of times. Using ´rgbBuf` avoids
|
||||
// creating many intermediate strings.
|
||||
static makeCssRgb(r, g, b) {
|
||||
rgbBuf[1] = r;
|
||||
rgbBuf[3] = g;
|
||||
rgbBuf[5] = b;
|
||||
return rgbBuf.join("");
|
||||
static makeHexColor(r, g, b) {
|
||||
return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
|
||||
}
|
||||
|
||||
// Concatenates two transformation matrices together and returns the result.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue