OverviewFilesCommitsIssuesDocsReleasesPeers

favela-surface / preview.sh

15 lines · bash ref:
#!/bin/bash
# Render one page and screenshot it in both themes. ⚠ Headless chromium honours
# prefers-color-scheme via --force-dark-mode / default light, so both are real renders rather than
# a guess about what the media query does.
set -e
cd "$(dirname "$0")"
PAGE="${1:-timeline}"
node preview.mjs "$PAGE"
URL="file://$PWD/preview.html"
chromium --headless --disable-gpu --hide-scrollbars --window-size=760,1100 \
  --screenshot=preview-light.png "$URL" 2>/dev/null
chromium --headless --disable-gpu --hide-scrollbars --window-size=760,1100 --force-dark-mode \
  --enable-features=WebContentsForceDark --screenshot=preview-dark.png "$URL" 2>/dev/null
echo "preview-light.png preview-dark.png"