diff --git a/README.md b/README.md index 1164301..cb97182 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ Parameters: --no - exclude "image", "stylesheet", "script", "font" --click - example: ".selector>a" excellent way to close popups or to click some buttons on the page. --file - output file name (optional, otherwise based on page title and timestamp) +--theme - switch to dark or light color theme +--vd - Emulate vision deficiency 'achromatopsia', 'deuteranopia', 'protanopia', 'tritanopia', 'blurredVision', and 'none'
List of of supported mobile devices: https://github.com/GoogleChrome/puppeteer/blob/master/DeviceDescriptors.js
diff --git a/index.js b/index.js old mode 100755 new mode 100644 index f20fab9..3a36dd7 --- a/index.js +++ b/index.js @@ -18,6 +18,8 @@ program .option('--no, [no]', 'Exclude') .option('--click, [click]', 'Click') .option('--file, [file]', 'Output file') + .option('--theme, [theme]', 'Color Theme light or dark') + .option('--vd, [vd]', 'Emulate vision deficiency') .parse(process.argv); if (!program.url) { @@ -58,6 +60,12 @@ console.log(program.fullPage); if (program.h && !program.fullpage) program.fullPage = false; await page.setViewport({width: Number(newWidth), height: Number(newHeight)}) } + if (program.theme) { + await page.emulateMediaFeatures([{ name: 'prefers-color-scheme', value: program.theme }]); + } + if (program.vd) { + await page.emulateVisionDeficiency(program.vd); + } if (program.emulate) await page.emulate(devices[program.emulate]); else diff --git a/package.json b/package.json index 104d966..5a0ba7b 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,17 @@ { "name": "screenshoteer", - "version": "1.0.9", + "version": "1.1.0", "description": "Make screenshots and device emulations form your terminal", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "bin": { - "screenshoteer": "./index.js" + "screenshoteer": "index.js" }, "dependencies": { "commander": "^2.19.0", - "puppeteer": "^1.10.0" + "puppeteer": "^4.00.0" }, "keywords": [ "screenshots",