Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow providing background color #60

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -62,6 +63,7 @@ module.exports = async (opts) => {
output,
animationData = undefined,
path: animationPath = undefined,
background = 'transparent',
jpegQuality = 90,
quiet = false,
deviceScaleFactor = 1,
Expand Down Expand Up @@ -183,7 +185,7 @@ module.exports = async (opts) => {
}

body {
background: transparent;
background: ${background};

${width ? 'width: ' + width + 'px;' : ''}
${height ? 'height: ' + height + 'px;' : ''}
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down