From 22a2419185bc30bd5b6addddc877d79590a90955 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 26 Sep 2023 17:16:46 +0530 Subject: [PATCH] feat(scripts): generate dark and light feature graphics --- scripts/refresh-feature-graphic.sh | 38 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/scripts/refresh-feature-graphic.sh b/scripts/refresh-feature-graphic.sh index 456e4c11..7d0b9e60 100755 --- a/scripts/refresh-feature-graphic.sh +++ b/scripts/refresh-feature-graphic.sh @@ -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