Skip to content

Commit

Permalink
Add darkMode option (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
brudaswen authored Dec 15, 2020
1 parent 6785f65 commit aa2eec5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dependencies": {
"array-differ": "^3.0.0",
"array-uniq": "^2.0.0",
"capture-website": "^0.4.0",
"capture-website": "^0.8.0",
"date-fns": "^2.2.1",
"filenamify": "^3.0.0",
"filenamify-url": "^1.0.0",
Expand Down
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ Default: `false`

Set background color to `transparent` instead of `white` if no background is set.

##### darkMode

Type: `boolean`\
Default: `false`

Emulate preference of dark color scheme.

### pageres.src(url, sizes, options?)

Add a page to screenshot.
Expand Down
4 changes: 3 additions & 1 deletion source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface Options {
readonly userAgent?: string;
readonly headers?: {[key: string]: string};
readonly transparent?: boolean;
readonly darkMode?: boolean;
}

export interface Source {
Expand Down Expand Up @@ -266,7 +267,8 @@ export default class Pageres extends EventEmitter {
scaleFactor: options.scale === undefined ? 1 : options.scale,
type: options.format === 'jpg' ? 'jpeg' : 'png',
userAgent: options.userAgent,
headers: options.headers
headers: options.headers,
darkMode: options.darkMode
};

if (options.username && options.password) {
Expand Down

0 comments on commit aa2eec5

Please sign in to comment.