diff --git a/index.js b/index.js index 7d07176..c240ae2 100644 --- a/index.js +++ b/index.js @@ -39,6 +39,7 @@ const injectLottie = ` * @param {string} opts.output - Path or pattern to store result * @param {object} [opts.animationData] - JSON exported animation data * @param {string} [opts.path] - Relative path to the JSON file containing animation data + * @param {string} [opts.background] - Optional background color * @param {number} [opts.width] - Optional output width * @param {number} [opts.height] - Optional output height * @param {object} [opts.jpegQuality=90] - JPEG quality for frames (does nothing if using png) @@ -62,6 +63,7 @@ module.exports = async (opts) => { output, animationData = undefined, path: animationPath = undefined, + background = 'transparent', jpegQuality = 90, quiet = false, deviceScaleFactor = 1, @@ -183,7 +185,7 @@ module.exports = async (opts) => { } body { - background: transparent; + background: ${background}; ${width ? 'width: ' + width + 'px;' : ''} ${height ? 'height: ' + height + 'px;' : ''} diff --git a/readme.md b/readme.md index 9eff8af..9b53035 100644 --- a/readme.md +++ b/readme.md @@ -93,6 +93,7 @@ Type: `function (opts): Promise` - `opts.output` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Path or pattern to store result - `opts.animationData` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** JSON exported animation data - `opts.path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Relative path to the JSON file containing animation data + - `opts.backgound` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Optional background color - `opts.width` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional output width - `opts.height` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional output height - `opts.jpegQuality` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JPEG quality for frames (does nothing if using png) (optional, default `90`)