feat(scripts): generate dark and light feature graphics

This commit is contained in:
Harsh Shandilya 2023-09-26 17:16:46 +05:30
parent de921bf786
commit 22a2419185
No known key found for this signature in database

View file

@ -8,20 +8,30 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
SCREENSHOT_DIR="${SCRIPT_DIR}"/../screenshots
# Run the Maestro flow to generate the screenshots
"${SCRIPT_DIR}"/run-maestro-flows.sh feature_graphic.yml
function generate_grid() {
# Run the Maestro flow to generate the screenshots
"${SCRIPT_DIR}"/run-maestro-flows.sh feature_graphic.yml
# Use imagemagick to stitch the screenshots in a grid
montage -tile 2x0 -geometry +0+0 \
-border 0 -density 300 \
"${SCREENSHOT_DIR}"/HottestPosts.png \
"${SCREENSHOT_DIR}"/CommentsPage.png \
"${SCREENSHOT_DIR}"/SavedPosts.png \
"${SCREENSHOT_DIR}"/SearchPage.png \
"${SCRIPT_DIR}"/../.github/readme_feature.png
# Use imagemagick to stitch the screenshots in a grid
montage -tile 2x0 -geometry +0+0 \
-border 0 -density 300 \
"${SCREENSHOT_DIR}"/HottestPosts.png \
"${SCREENSHOT_DIR}"/CommentsPage.png \
"${SCREENSHOT_DIR}"/SavedPosts.png \
"${SCREENSHOT_DIR}"/SearchPage.png \
"${1:?}.png"
# Convert the resulting PNG to WebP
cwebp .github/readme_feature.png -o .github/readme_feature.webp
# Convert the resulting PNG to WebP
cwebp "${1:?}.png" -o "${1:?}.webp"
# Remove the now-useless PNG
rm ".github/readme_feature.png"
# Remove the now-useless PNG
rm "${1:?}.png"
}
adb shell "cmd uimode night no"
generate_grid "${SCRIPT_DIR}"/../.github/readme_feature_light
adb shell "cmd uimode night yes"
generate_grid "${SCRIPT_DIR}"/../.github/readme_feature_dark