Ensure pdfBackground constructor property is used #4207

Slightly refactor the way background colours are set
This commit is contained in:
Lovell Fuller
2025-04-09 22:21:14 +01:00
parent a642767329
commit 5b5dfbad77
4 changed files with 31 additions and 35 deletions

View File

@@ -3,7 +3,6 @@
'use strict';
const color = require('color');
const is = require('./is');
/**
@@ -67,13 +66,7 @@ function rotate (angle, options) {
} else if (is.number(angle)) {
this.options.rotationAngle = angle;
if (is.object(options) && options.background) {
const backgroundColour = color(options.background);
this.options.rotationBackground = [
backgroundColour.red(),
backgroundColour.green(),
backgroundColour.blue(),
Math.round(backgroundColour.alpha() * 255)
];
this._setBackgroundColourOption('rotationBackground', options.background);
}
} else {
throw is.invalidParameterError('angle', 'numeric', angle);