From 237e1225a95343576f015a5fda533e5688c9a562 Mon Sep 17 00:00:00 2001 From: Ken Crimmins Date: Thu, 16 Nov 2023 16:23:19 -0800 Subject: [PATCH] add icon script to readme --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index bb5082be2..625d881da 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,35 @@ We consider a component PR complete when it has the following: - Tests added/updated for any code added/updated - Existing tests & lint passes (integrated with GitHub Actions, but you can also run both locally) +### Adding new Icons + +Our SVG Icons require a range of sizes from 14px to 24px. For convenience, you can use the following shell script to generate resized copies of an svg at the relevant sizes: + +```bash +#!/bin/bash + +SIZES=(14 16 18 20 24) + +for FILENAME in "$@" +do + echo "Processing $FILENAME" + for SIZE in "${SIZES[@]}" + do + echo "Resizing to $SIZE"x"$SIZE" + NEW="$(echo "$FILENAME" | sed -e "s/svg$/$SIZE.svg/")" + rsvg-convert "$FILENAME" -w $SIZE -h $SIZE -f svg -o "$NEW" + done + echo "Done processing $FILENAME" +done + +# e.g. ./ResizeIcons.sh arrow_icon.svg house_icon.svg +``` +**Note:** You must have librsvg installed to use this script: +``` +brew install librsvg +``` + + ## Deploying Updates When a PR is opened Amplify will automatically build and deploy a PR preview. You will see the URL for the preview in a comment from the Amplify bot in the PR.